The fun thing about the medieval period is that its polities were extremely fragmented. Large kingdoms like France had power split between the king and various powerful vassals, many regions didn't have a large unifying kingdom, and I'm not sure which category to put the Church(es) or the Holy Roman Empire into.
Individuals held a lot of power, but power was split between a lot of individuals.
(These qualities aren't unique to the medieval period, of course. But they contrast with the prior and subsequent periods of European history—Rome's exceptional-for-the-West territorial conquest and state capacity, and the early modern period's increasingly centralized proto-nation-states.)
Add in magic, and in particular the ability for adventurers to exponentially increase their power by looting ancient ruins and beating up weird monsters. Now it's realistic (or at least verisimilitudinous) for a gaggle of mercenaries/tomb robbers/thugs to amass enough power to compete with the local lords.
Alternatively, the king might nip that problem in the bud by offering the adventurers their own fiefs, integrating their power into his military system. Which means the adventurers would be competing and feuding with the other vassals.
A large kingdom might be able to muster enough power to crush the adventurers, but that power isn't united; if the king tries to force matters, they can ally with one or two of his big vassals and turn it into a fair fight.
And with how medieval warfare works—the relatively small armies (compared to their Roman or early-modern-European or Chinese counterparts), the reliance on "foraging" (raiding) to feed those armies, the unsophisticated siegecraft—it should be possible for a D&D-ish game to shift between its equivalent of "dungeon crawling" and its warfare without needing to dramatically alter the gameplay focus.
If I were making this game, I'd mix in a bit of mythic flavor. Specifically, those myths where a lost sphinx can pull a sword out of a stone or kill a sphinx or whatever and be crowned king. Though that might work better in a setting inspired by the even more fragmented poleis of Classical Greece...?
Either way, I think this is a more natural escalation than most D&D-adjacent games have.
Instead of going from "fighting spiders in a cave" to "fighting demon spiders in a hellcave," or from "fighting cultists in a crypt" to "fighting cultists to Save The World," you go from clearing out local hazards to fighting legendary monsters to founding a kingdom.
I think there's something there, but I don't think any D&D-adjacent games have quite figured it out. There's always a divide between the individual-combat dungeon-delving side of the game and the realm-management side; two separate games with two separate kinds of mechanics. I feel like there's a way to unify them better, by making the "dungeons" more mass-combat-ish and focusing more on the violence needed to maintain a kingdom.