I have some unusual, from the normal browser user perspective, DNS stuff and this just leads to a bunch of questions.

My gateway has a bunch of static DNS entries for internal hosts, which are all in a fake top-level domain. How will resolving these work if the request goes to CloudFlare? CloudFlare obviously doesn't know about my internal domain. Currently my gateway resolves what it knows about and uses my ISP's DNS to resolve what it doesn't.

Pi-Hole is presents a similar problem.

Finally, if DoH is the future, how do I run my own DoH server which can resolve internal hosts? Does such software even exist yet? How do I point Firefox at this DoH server? The relevant Wikipedia article[0] points to a list of public DoH servers I can use, but offers no insight as to what software I'd use to run one for my own use.

[0] https://en.wikipedia.org/wiki/DNS_over_HTTPS

cloudflared, knot-resolver, stubby, unbound, CoreDNS can be run as DoH and/or DoT stub and/or recursive resolvers, locally.

The easiest stub resolver to setup would be nextdns' client: https://github.com/nextdns/nextdns