The wider an area you wall off, the less sense it makes if your goal is protection from your enemies.
I don’t want to be trapped in an enclosure with the Clintons, the Bushes, Obama, Chuck Schumer, Joe Arpaio, or any other large-scale archator.
In fact, there are very few people I would want to be kept in the same box with.
House walls are a positive thing because it is fairly easy to be sure you’re not trapped inside with people you hate, and you can effectively keep those types of people out. If they get in you can throw them out or leave pretty easily.
The same goes for fences around private property. Fence off your yard, and control who you let in.
Walls around cities are less optimal, even if you ignore property rights, because you are going to be inside with some people it makes no sense to share a controlled space with, but it would be doable to move to a different city if you found yourself locked in with your enemies.
But walls around a country? It’s absurd! Most of the people inside with you want to violate you, as do those who build and control the wall. You are trapping yourself with people who are just as bad as those you want to be protected from. Often, even worse.