It's not that it doesn't do anything. Walls are an excellent way to corral and funnel enemies. Sanctuary, in particular, seems to have a number of interior spawn points (the big tree, between you old house and the neighbor, near the river) as well as the usual at the bridge and down the hill near the bend in the river. Me, I limit my actual settlement to the interior section around the workshop building and close by and use the rest of the land for other purposes. I don't worry too much about the farm area as you can always expand that and I make sure that my turrets are well protected as well.
A trick I found that worked very well for me was to build gates just past the foundation next to the Workshop building and between my old house and the workshop building and use both defensive towers and protected turrets along with walls to make choke points. leading to those. Between the two towers on either side of the gate, the turrets and the choke points with well armed settlers, I'm doing allright. Yesterday, we had an attack by 5 Deathclaw that spawned near the bridge. They headed right up towards the main gate but ended up being funneled to the two sides since there was a tower in front of the gate as well as two on either side along with turrets and the walls that forced them to come in from the sides, between the two heavy turrets, both guards and 1/2 a dozen settlers with mini-guns and muskets, it was short work. I've also found that, as long as you can keep your enemies off balance, equipping your guards with Molotovs actually buys time for the other settlers to get in to place.
I do have to give a shoutout to Jun and Sturges on the towers and Preston for rallying the troups just inside the gate. The did a great job.