There are many times where my knights and footmen are defending an area, and will just sit there when enemy archers are pelting them with arrows. I think the AI should be changed to allow them to leave the marked defense zone up to 80 blocks from the center if they are hit with a projectile. This would allow them to attack archers who are attacking them, and if the archers retreat, then they would return to the defense zone until they are attacked again. This would stop them from sitting there until they are incapacitated.
This is a bigger issue earlier in the game, before you get higher level archers with enough range to attack back without leaving the zone. More so on hard difficulty where goblin archers appear sooner.