MacOS Resolution of localhost
It seem like this is, in fact, hardcoded in mDNSResponder.
╰─ grep -A5 -B5 &quot;Register localhost&quot; ./mDNSResponder-1096.40.7/mDNSMacOSX/mDNSMacOSX.c
        const domainname *const localHostName     = (const domainname *) &quot;\x9&quot; &quot;localhost&quot;;
        const domainname *const broadcastHostName = (const domainname *) &quot;\xd&quot; &quot;broadcasthost&quot;;
        const mDNSv4Addr        localHostV4       = { { 127, 0, 0, 1 } };
        mDNSv6Addr              localHostV6;
        // Register localhost 127.0.0.1 A record.
        RegisterLocalOnlyARecord(localHostName, &amp;localHostV4);
        // Register broadcasthost 255.255.255.255 A record.
--
--
        // Register broadcasthost 255.255.255.255 A record.
        RegisterLocalOnlyARecord(broadcastHostName, &amp;onesIPv4Addr);
        // Register localhost ::1 AAAA record.
        mDNSPlatformMemZero(&amp;localHostV6, sizeof(localHostV6));
        localHostV6.b[15] = 1;
        RegisterLocalOnlyAAAARecord(localHostName, &amp;localHostV6);
    }