It was edited in the OP, but they were asking about "spellcasters" not just wizards.
You ask what edition, but then you don't make a point that actually makes any sense. You don't need to be a PC to be a wizard, as multiple statblocks like Archmage, Enchanter, Necromancer, Transmuter, Conjurer, ect show us. You don't need to be a PC to be a Warlock, as shown by the stat blocks like Warlock of the Archfey, Warlock of the Fiend, Firenewt Warlock of Imix, Yuan-ti Nightmare Speaker, Yuan-ti Mindwhisper, ect. And for sorcerer you have the derro Savant, Kobold Scale Sorcerer, Occult Extollant, as well as the Dragon rules.
Having a class isn't a prerequisite to being a spellcaster. And it is trivial to say that a family DOES have a sorcerous bloodline and can all cast spells, without even needing them to all be "high level" whatever that means.
How does your reply of the celestial choosing a ruler and granting them powers in any way invalidate the idea of the rulers being given supernatural powers? That sounds like you agree with me.
Sure, maybe the King can't have a warlock pact with a fey, but what about a Duke? A Baron? The common people might actually not see it as split loyalties but as a political alliance. No one gets mad at America for having a mutually beneficial deal with Canada. Why would they be upset that the Royal Family has such a strong bond with the powerful fey of the ancient forest that they are granted supernatural abilities? It is no different from having a strong bond with the nearby dwarven nation and receiving high quality weapons and armors.
Remember, a Pact is not a immediately a pact of servitude or one where you sell your soul. It is a contract. And nations make contracts with foreign powers all the time.
Additionally, there are DOZENS of warlock powers that would be insanely useful for ruling.
Why?
When rulership in France changed hands through "right of force" that didn't mean that the English Kings who had also claimed their kingdoms through force of arms suddenly had to find a new system of government.
Think about it in terms of averages. Who is more likely to rule over time? Is it the person with the biggest muscles? The strongest constitution?
No. Rulers tend to be the most charismatic, the most intelligent, the wisest. Which also describes spellcasters. They are the people in DnD who tend to have the highest mental scores. Again, solely on averages, exceptions certainly exist. But we seem to view "The King was a mighty warrior in his youth" as a nothing statement, it is a default assumption. However, "The king is a mighty wizard" is somehow being presented as bizarre. Like it could only happen if there is a council of wizards which took over the world, instead of natural selection pressures.
IRL Kings tended to be seen as powerful warriors, because a warrior leading an army was an effective way of becoming king. In a DnD world though, it makes just as much, if not more sense, for that warrior king to be a spellcaster. So, over the centuries, why would spellcasters not be the default people in charge?