The lack of an ability to tell the AI that my borders are closed is one of the reasons why I tend to simply go to war with every AI I meet that doesn't have something I want in their shops which I could not get otherwise (which basically means they are Altar, New Pariden until my champions have as many spellbooks as I want them to have, and Capitar if I want the warhorses - assuming that Capitar sells warhorses in its shops instead of regular horses). That, and I hate it when they send a unit across my territory (because I really don't want to enter the diplomacy screen every single turn to tell them to get out) and beeline towards a hero I've been waiting to recruit due to funds or research priorities when they shouldn't know that that hero even exists.
The only times in history when nations have sent armies wandering through the territory of other nations is when they are at war, made prior arrangements with the nation over whose territory their army is passing to allow that passage to occur, are allies and have a reason to send armies into their ally's territory, or don't care what the other nation thinks of having their army pass through the territory of the other nation (trying to provoke a war, think that the other nation isn't strong enough to be a concern even if they take enough offense at the unsanctioned passage to go to war, etc).
Well, there's also the "we aren't TECHNICALLY at war, but I think that that bit of land is mine and you think it's yours, so I'll keep an army camped there to keep your army out of there, and if you send people by we'll kill them, but we aren't prepared to invade what we agree is your territory over it" situations, i.e. ill-defined or disputed borders - which don't visibly occur in E:FE. All national borders are clearly defined, with the potential for no-mans lands where anyone can travel.
I suspect that it will be hard to implement, however.
The game already has a means of checking if something is within my territory. All that needs to be done to establish a closed-borders situation is to set up a flag that tells the AI to check to see if the path of a unit ends inside of another faction's territory (i.e., would trigger an 'enemies are in your territory' alert if the AI and the other faction were at war), and then decide if it wants to provoke that player by moving its units into their territory or not. Territory violation by passing completely through another player's territory in a single turn would be more difficult to prevent, but because most units can only move two to four spaces in a single turn it also isn't as likely to occur as moving into another player's territory and ending the turn while still in that player's territory.
I also don't mind the territory violation by crossing into and out of my territory in a single turn as much as the AI ending a unit's turn inside of my territory, since at least if they crossed into and out of my territory in a single turn I don't have to tell them to leave via the diplomatic screen.