Re: Hosts file
Default behaviour in Firefox is to fallback to the OS configured DNS if the DoH resolution fails (fail including NXDOMAIN here). The behaviour is set by network.trr.mode
What it might do, though, is break any split horizon DNS you might be doing. My approach to that was to run my own DoH servers and split-horizon them (i.e. dns.bentasker.co.uk is 192.168.1.1 or whatever at home, and points to my public infra when resolved from the net)