It really depends on how common these monsters are, or rather how commonly they attack. If all your towns are "Hommlet"-esque, with no defenses, that suggests that monster attacks are rare. At least as rare as raider attacks on villages were in real life.
Maybe it's not uncommon to see dragons flying overhead or bands of orcs wandering around, but they almost never actually attack settlements. In that case, there's little imperative to build walls. If monster attacks, not sightings, are common, then yeah, defenses should also be a lot more common.
However, there's also a cost-benefit analysis. If villagers have the ability to make stone walls, but the main risk is a dragon attack, then those walls are going to do bupkis. There's no point in building them. Likewise if the raiders are known to have wizards who can blast walls apart, then spending the time, energy, and money to build those walls doesn't make much sense.
I did about two seconds of research on how medieval towns dealt with Viking attacks, and the main immediate ways seemed to be beacon fires to summon help, building watchtowers for early notice, and earthwork fortifications to keep them out. Depending on how common magic is, spells can replace beacon fires (in D&D, animal messenger and sending). They can also replace walls--maybe none of the current spells, but I can imagine something akin to a very large forcefield that's not impervious, but requires a save or ability check to pass through and thus keeping the bulk of the raiders out, but with a minimum cost of requiring the caster, or casters, to do nothing but maintain the spell. (Maybe instead of requiring multiple spellcasters, which a village may not have, you need one caster and a bunch of regular folk to help out in some way--then you're relying on the morale of those people to hold up, because if any of them flee, the forcefield falls.)
It's also possible that instead of building walls, people build hidden basements and hid in them--as long as they survive, they can deal with loss of belongings. Your map of Hommlet won't show them, of course, and if they're hidden well enough, then there's no reason why the PCs didn't discover them by accident. Watchtowers can still be used, but in a fantasy world, the villagers may have treaties with woodland dwellers who are willing to act as eyes and ears.