OK, so bear with me for this one.
MEGALOVANIA was originally used as Dr Ardonut, a character who tried to go against the fate of the death of his child, and ended up creating a whole campaign out of it.
MEGALOVANIA is used again for Vriska, who plots most of the shenanigans in Homestuck, indirectly creating Jack Noir's demigod status. She does this with the intention of leaving a significant mark on the story, to shape it. She's also a notable cheater.
MEGALOVANIA is once again used for Sans, who tries to stop the player's inevitable genocide in an attempt he knows is futile, yet he still enacts it.
These characters all have in common a trait of attempting to change fate — not gaining freedom for themselves, but simply attempting to alter fate. But why would Sans, the funny bone man from Snowdin have the right to continue such a legacy?
Well, all roads lead to W.D Gaster.
We hear from the Followers that he was the royal scientist. But followers can lie, or omit truth, in the interest of their leader. What if W.D Gaster was more than just a scientist? We hear that he was shattered across space and time by his creation, but what proof can we see of anything powerful enough to do that, save W.D Gaster alone? SAVE files are limited by determination, and W.D Gaster's work seems to have focused on timelines (Determination seemed to be Alyphs's line of research instead). The timelines, although being a potent source of power, seem to be highly passive in that it takes an individual with significant determination to manipulate their power into SAVEing — other than that, no evidence for timeline shenanigans exists much beyond the player, who's a whole other can of amalgation. But W.D Gaster can't have encountered the player, because then we would have had a campaign involving him, a small game of sorts, before UNDERTALE's release. Since this never happened, he can be inferred to never have interacted with the player before UNDERTALE, therefore eliminating the list of known anomalies for him to have encountered. And science doesn't just work like "build an experiment and it will work", mistakes happen all the time. But W.D Gaster's case seems to have failed incredibly — perhaps too incredibly. Because what if this whole time he was something greater? After all, (and this part may be confusing) if we take a 2d drawing, then we, 3d people, can make any mark anywhere on the drawing without having to "move" or anything. What if W.D Gaster isn't shattered, but instead acting through a higher dimension — 2.5d if you will. This explains not only why Sans gets the right to MEGALOVANIA instead of, say, Undyne, but also his knowledge and why he and Papyrus are named after fonts from our world, not the world of UNDERTALE. As for Papyrus, he acts extraordinarily innocently. But is this perhaps because he knows, as a Gaster, he cannot be "harmed"? (Even if you kill him in a genocide run, if you reset after beating it you can play through the game and he'll be there, unharmed and protected by the power of SAVEs.) He is shown to be merciful, and surprisingly competent at certain areas (not so much at cooking though...) and highly trusting in others — perhaps because he knows there is a reality, no matter what, where that person is the best version of them that they can be. Of course, Papyrus might not have ALL the information, and seems to be slightly lesser than San in hierarchy — Sans, in DELTARUNE, is a full-on NPC with a somewhat significant presence in the story, while Papyrus is stuck at home (yes). Sans, also having MEGALOVANIA, may therefore be the heir to W.D Gaster's rulership over the void/depths. (Another piece of evidence is that W.D Gaster controls DELTARUNE to an extent, however he calls it his "EXPERIMENT"...this may just be another masquerade as a simple scientist to mask his true power.)
Call me crazy, call me a larper, but here's a theory I have: W.D Gaster is the ruler, and Sans is his heir.