Wouldn't setting the DNS server to 127.0.0.1 prevent my system from actually resolving remote hosts? I found this answer

Solution 1:

The implied suggestion is to run your own resolver (caching name server) and then configure your system to use that.

Just setting /etc/resolv.conf to localhost without running your own name server will break resolving.

Solution 2:

Both solutions that you link to suggest that for a mail server (a service that will generally be doing lots of DNS lookups), it's probably better to run your own local resolver server rather than rely on one provided by your ISP or similar (which might either be overloaded or have rate limits).

Note that they don't claim that you necessarily have a local resolver server already, but if you do install one (for instance one of unbound, bind, knot-resolver, powerdns-recursor), you would then change resolv.conf to point to it (if running on the same machine, nameserver 127.0.0.1 should be suitable).