Re: not going to work
You're only blocking 3 major DNS providers, just on ipv4, and the code is already sizeable.
If you add more of them and throw ipv6 into the mix it's going to get out of hand pretty soon.
I'm doing it differently, by just allowing my pi-hole outbound acces to 53/853 udp/tcp and dropping everything else by default; it's certainly shorter. I'm not addressing DoH in any way, but neither is your setup.