Wifi not connecting after erasing hard drive on Macbook Pro 13" 2019
The problem, as you’ve confirmed, is a DNS issue.  What’s happening is that your Mac has no way of finding the Recovery Host to connect to. 

macOS Recovery Hosts and Ports

Normally, this is taken care of in the router.  What happens is one of the two scenarios:


The router acts as a DHCP relay.  In the DHCP offer, the DNS server value is the IP address of the router.  So any DNS request is sent to the router which is then sent to the actual DNS server(s) that are either automatically configured from the ISP or manually configured by you.
The router passes the DNS server addresses as part if the DHCP offer.  Whether automatically configured from the ISP or manually configured, the client (your Mac) gets the IPs of the actual DNS server(s) and makes the request directly.


If this is not happening...


check your router configuration and make sure the DNS values ate being set.
Manually set the DNS server in macOS with the command networksetup -setdnsservers Wi-Fi 8.8.8.8 (Google’s DNS server)


If fixing DNS proves fruitless, you may need use a working Mac to create a USB Installer.  This will allow you to at least install the OS without needing the Internet and then, you can use whatever work around that fixes your DNS.