Summary:
The AI of the defenders of all Battania castles has a bug - melee troops only protect the gates and drop ladders, but do not react to the enemy who entered the territory of the castle.
As a result, you can bring your archers and put them on the wall so that they kill the defenders, or...