I just had the same problem and neither of the solutions above worked as the problem stemmed from somewhere else. It turned out the domain I tried to connect to (with cloudflare tunnels btw, i.e., with ProxyCommand), was not resolved. I am pihole and the external filters blocked the domain resolution for my SSH server. Hence, when I wanted to connect to the server, due to the blackholing of blocked domains, the IP it was resolved to was my localhost. So everytime I wanted to connect to that domain, it tried to connect to localhost.
The solution was to update my pihole container to the latest version and now it is working.