By the time you get to the moonlord you've no need for a portal gun, you'll have wings, a mount (possibly flying), probably a couple wired teleportation pads, maybe a rod of discord, you should get it sooner than endgame. It's quite fitting for the moonlord to drop it, yes, but at that point...