Defensive walls are expensive to build, maintain, and man, so there's a reason you didn't see them in every community outside the larger ones or those built specifically for defensive purposes.
Which is probably why the latest DMG goes out of its way to say the rules aren't meant to model a realistic setting. Wall of Force only lasts for 10 minutes anyway. And, like a real wall, having someone around all the time ready to cast Wall of Force sounds expensive. Aren't there better things you could spend your gold on?
This is where we run into the issue between setting and game (as I think you are saying.) Wall of Force lasts for 10 minutes because that's the game having a rule that the designers have installed. However, if we were to consider any sort of "reality" of human beings within a certain setting having learned about and able to use magics that are represented by these "game rules"... none of these settings would be stuck with these rules as their actual only method for using them. In-setting characters have been inventing "new magic" all the time... after all, most magical traps aren't just game-rule "spells" that go off, but instead are completely original magical effects that a DM creates and places that "in-world"... and these original magical effects would have had to have been made up or created by some magician within the setting and put there. Which tells us that within these settings are all types of magic that are not actually represented by the "game rules" of Dungeons & Dragons. Magic exists extant of the game rules. Thus we cannot use game rules as our only window to the "reality" of what these setting have or do.
And thus comes the idea that magic within any of these settings would never get stuck ONLY in the forms of these "magic spells" the game rules gives us. They would be iterated upon by the in-world characters that use magic, and paid for by the in-world movers and shakers that could pay to have more people learn magic over the years and thus create new magic. Including walls of force that could be made
permanent (for example). Would that cost a lot of money? At first, sure... but over the years as more people learned how to create and change "magical force", the costs would go down and the strength, usefulness, and ubiquity would grow and grow and grow. And that some point... force objects would become so easy and cheap to create that a person would be able to just go down the street to their own local shop and buy a "personal force-field" generator to cover their house (let along the town-wide force domes covering entire villages.)
After all... Charles Babbage, the first person to originate the concept of a 'programmable computer' did not see their work of mechanical computation begin and end with his invention. It was advanced. Over and over by more and more people. Becoming more and more powerful, more and more effective, faster and faster to work, cheaper and easier to make. Until we reach today... a little over 200 years following the announcement of his invention... and have now seen computers having taken over our world. And yet in most fantasy games we have histories several millennia long with magic or technology remaining exactly the same over that entire time, with little to no advancement or progression. And the reason for that illogic is simple... to facilitate our desires for the "fantasy" of our fantasy stories and to keep balanced and fun gameplay--
not to give us any anthropological timeline of where people most likely would actually be if these 'Humans' in these fantasy worlds are meant to be like us real Humans in our real world.