Thats not the way it works.

Your Mac is a client on the network(s) you attatch to and it gets its settings from from the DHCP server. In that DHCP response, theres a number of things including a DNS server assignment(s) which is where all the names on the network come from. Those name to address relationships are ultimately managed by the network admin.

Your client can’t arbitrarily assign names to IP addresses as your Mac is not the DNS server.

The /etc/hosts file is for you and you alone and must be manually updated (if necessary) when you change networks because there is nothing that’s mapping the actual router address to the name you’ve arbitrarily given it.