"Why not having a Pharaoh-like counters? They were crude, but they did help to get around things. You have population of n. Each X of population "requires" a building of specific type. Counted properly, you have the right amount of forts, barracks and lodges, you have security covered by those, without walls.
If it's already in game, then it should be more "visible" to a player. If it's not, then I find it superior solution to "just wall it, bro"."
To some extent, this feature is present- building forts/barracks/lodges increases your settlement's 'Might' rating, which in turn affects perceived safety from invasion. But I agree this should be more visible to the player.