In default D&D, there's religious freedom, (mostly) racial tolerance, and magic is seen with awe, respect and maybe fear, but not necessaily inherently evil, and strangers are almost always immediately offered a dangerous (but handsomely paid) jobs. That's NOT medieval by ANY means. Why, thats and improvement over ANYWHERE in the real world.

A pseudo-medieval word offers many convenience for murder-hobos: you don't pay taxes, you don't have to have a passport to enter a different country, its lawless enough to give jobs to random bands of mercenaries.

More importantly, as somebody said, its more credible that you can solve things with swords. In a modern setting, a your average dungeon would very likely flooded with a compost lethal to monsters but harmless to precious metals and magical items; all handled by the countries military. Lack of technology is what makes DnD playable.