Temporary failure in name resolution - only on localhost

That's expected behaviour since 5.0:

See also Correct Resolv.conf entry in pihole 5.11 - #2 by jfb, where jfb explains the ins and outs of picking a DNS server for the machine that hosts Pi-hole.