I want to host hundreds of instances of Discourse

Until you need to expand to multiple multisite instances, a single A wildcard A record is all you need. Other DNS providers don’t have that limit.

You would need to write it yourself.

Then you really don’t need to solve the 500 city problem right now. I would recommend just using a single site per droplet to start. Until you have > 5 cities, there’s little advantage for multisite.