Well, while creating custom units and experimenting different combinations you may sometimes face such situations. Maybe giving melee skills to ranged units or vice-versa, modfiying priority value, etc. The World editor has many data fields. And there are lots of combinations you can experiment with. Of course in some cases units behave in unpredictable ways. When you add strange terrainings of map and odd ideas the creator has in his mind into this, of course weirdness may happen.