Re: Game AI comments
The gate opening can be prevented by stationing at least one unit right inside of it in the deployment phase. It opens if you move too close\closer to it, as it is supposed to do, ergo do not move that unit forward once you have stationed it and play has started. Any additional, supporting units should never be ordered to move closer then the initial unit once play has started for the same reason - unless the gate has been breached already.
Unfortunately there is no 'lock the gates' button that would make this easier - but then it would disable exiting the settlement\castle through other gates. Nothing more embarrassing if you would forget 'unlocking' the gates if you intend to make a counter attack from the side\back or if doing so opening the attacked gate.