Military buildings and assigning posts

so this is an idea i had while i saw my archer shooting enemies through the gate rather than heading out and rushing towards the battle and i thought what if my archer was already there then another gat would not have been lost or if it was than the fight at least would have been easier when the bulk of my forces got there so i thought what if we had military buildings that you could assign certain classes of fighters to like at a gate you could assign a “gate guard” or footman (not a different class just a nickname i just thought of) or you could build a tower and assign an archer to it or even a wall (not a fence) that your men could patrol i know there is something kind of like what i’m saying where you can have your men “defend area” but this would be different with defend area the men are on constant alert with this command they would be patrolling the area the closest thing i can think of when talking about this is a game called prison architect where you can assign the prison guards routes to follow (sorry i don’t have a screenshot you’ll prob have to look up a playthrough or something) this would be useful for running the town so that the guards aren’t running in from the other side of town and your gate or a door is already destroyed if there is something similar to this than please notify me but i think this idea might be useful. thank you for reading all the way through.