This actually has to do with the routing tables work. IP routing tables are like a directory of who to send the packet to next. When you access an IP address, first it goes to your computer's routing table. In the case of 127.0.0.1 or your local IP assigned to your computer (192.168.0.XXX), that's as far as it goes, and your computer will be the one to receive the packet, and if there is a server on that port, the server will return some information to you.
In the case of when you access say superuser.com, your computer will use it's tables to determine that it needs to send the packet to your router, which will determine it needs to send it to your ISP's hub that you are connected to, then through a number more hubs until it reaches the server that superuser.com is hosted on. You can use the tracert command to map this path, my computer took 8 jumps to get there, but other locations can take many more than that.
When it comes to accessing your router (192.168.0.1 or 18.104.22.1687 in this case), your computer uses it's tables to determine that is needs to send the packet to the router. The router then realizes that the packet is destined for itself, as the destination IP is the same as one of the IP addresses assigned to one of it's network interfaces, and does a check either to see what interface it came from (WAN or LAN), and/or the IP that the packet came from. If it comes from the LAN interface, and is from an ip address in the correct subnet (192.168.0.XXX), it allows it, otherwise it denies access. This is how you can access your router from either address.
Of course, I would still check that remote management is not allowed, as a previous post mentioned.