Dns queries slow/timeout from localhost - fast when direct to dns server

The configuration from our unbound guide is targeting to configure unbound as a recursive resolver.

Forwarding all requests to an upstream resolver instead means you are giving up on that target completely.

Did you decide to switch from recursive resolver to DNS-over-TLS (DoT) instead?

In that case, you could also eliminate stubby and keep unbound and use it as a forwarding DoT resolver instead, see e.g. Recursive DNS server on pihole when using Public recursive name server - #3 by jfb.