Horde is very bad formation and you should never use it.
Infantry units with 'horde' will fail to ram the gates, have troubles navigating ladders/siege towers and in general moving around. It's not matter of XAI, it's a general problem.
For similar reason cavalry goes nuts in the same manner with this formation.
Crashes might be caused by our advanced pathfinding, or a random matrix of other factors.
Either way, it's not matter of the AI here.
Horde is broken and you use it on your own risk.
We don't fix buggy CA code here, feel free to send them a bug report, though (maybe you get answered in this century).