I'll note that this proof D&D already has nothing in common with a medieval society. That sort of leeway in a medieval society only exists if you are of the knightly caste, which itself has its own rules and expectations about how you behave. D&D - especially post Gygax D&D - consistently seems to avoid matters of social station, taxations, and license in its story. PC's seem perfectly free to just leave town and walk to the next town carrying a weapon without the slightest expectation of being executed as bandits for doing so, or the slightest expectation that the next town over will demand a blade tax on all of those weapons they have bigger than a simple dagger or knife. The right to bear arms isn't something that attaches itself to nobility, and xenophobia just doesn't seem to happen. PCs assume that they have a right to put on armor and go trapsing about as if they were the King's subjects and no one is going to care, which is very much not true of how medieval authorities would react.
One could argue that D&D assumes this adventuring class, and in a typical D&D party it's usually possible to assume there is blanket protection for the party being inherited through a cleric and his cult or a fighter by his birth or something and handwave it I suppose, but nowhere does D&D bother to explain things like: "any man of whatsoever estate or condition… to go armed, girt with a sword or arrayed with unwonted harness… or do aught whereby the peace may be broken or the statutes concerning the bearing of arms contrary to the peace, or any of the people be disturbed or put in fear, under pain of losing his arms etc. and of imprisonment at the king’s will” or that upon entering a city you have to pay tax on your belongs ("No man is to sell by any measure that is not sealed with the town's seal, upon pain of fine") and swear an oath in front of the bailiffs that you shall obey the cities laws and you can't go about carrying weapons unless you are a citizen of the city or have some other right to do so ("No Dutchman or other alien may bear a weapon, on pain of its confiscation"), or that even as a citizen if were out of your house armed after a certain hour you'd be presumed under the law to be a criminal.
Medieval societies in the D&D since were vastly more orderly and connected than they are now. Far more regulation legally and socially existed then than now. Reputation was vastly more important then than now because anything alien was so vastly more mistrusted. The designers of the Oriental Adventures assumed that things like Honor would need to be mechanically enforced because the setting was so alien to the modern reader, but the truth is an Occidental Handbook today would need to assume the same thing.
What D&D initially assumed is something like the 19th century American old west (or even the fictional 19th Century old west) with a nigh universal right to bear arms. But as the game progressed it never enforced that and the setting modernized over time. What D&D assumes now is that social intuitions are unimportant to the story and as such they gravitate to the ideas of whomever is playing the game becoming reflections of whomever is playing or running the game. I'd imagine that modern games have legal and social institutions that are rarely older than the 1920s, just with some fantasy trappings. Certainly in something like "Honor among Thieves" the society has no historical grounding to any real period and the social mores seem to be current and modern. It could as well been the MCU. If you set the game explicitly in the 1920s it might get more archaic in its feel. I'm pretty sure my Star Wars campaign is more medieval than most D&D games.