In 10 years time when cloudflare goes bankrupt/withdraws the free offering, will you be able to redeploy to another platform or will you start having to delve into 10 year old code and porting it to a new API?

Is there at least an nginx-cloudflare module that lets you self-host this stuff?

You can self host the entire Worker runtime if you'd like: https://github.com/cloudflare/workerd