I think the issue is just an artifact of "small starter town in reasonable proximity to dungeon that is now a threat" thing, which gets lifted as the default village pattern everywhere. When the creatures are in the dungeon but not raiding, and that is the threat, then maybe the village/town hasn't adapted to the threat yet.
It becomes much more obvious in a sandbox, when you have multiple possible threats, many of them nomadic, and some of them capable of doing serious damage to the civilized area. Anyone doing that from scratch and employing any thought at all will make the village more defensible.
Of course, this is also one of the limitations of the frequent advice to a new GM to "start small"--that's a home base and a dungeon. If it turns out you wanted some moving, wilderness threats nearby too, then you really needed to think about that when you started.