It seems that right now AI commanders give 'engage' orders no matter where the enemy is which leads to their subordinates breaking formation and chasing the enemy even 500m away despite being single or in a pair which makes ambushes all too easy.
Expected behavior:
When an enemy is further than 100m from the squad the leader should only give out TARGET orders so AIs won't break formation but still will fire at enemies when they are seen. This will make them stick together and force an enemy to come close which is a smart move.
When an enemy is within 100m from the squad the leader should give ENGAGE order as usual. That way soldiers will be able to hunt an enemy while still having a cover of their squad.
Additionally when soldiers will chase an enemy due to that order and will end up 200m+ away from the leader - the leader should immediately give them an order to fall back. This again will not let individual AIs fall easy prey to ambushers. This is especially important when AIs guard something