that the code somehow
can ammend that
According to the
Wiki here placement of troops is the same for all players in any battle. They have 2 pics in that section that may help make it clearer:

If I were getting something different than this, I'd take screenshots and send in a support ticket.
This is not what determines which of those troops would 'go first'; that is determined by the initiative of the unit and its placement. If all 5 are the same unit, (ex: 5 archers), then the order is 5,4,3,2,1. If there is a 3/2 split of units used, the order is determined by initiative , then placement. Ex: Archers/Frogs with Archers in positions 2,3 and Frogs in positions 1,4,5, then the order will be #3Archer, #2Archer, #5Frog, #4Frog, #1Frog.
I have never seen that order change.
I have seen players who get confused by the dogs/frogs. The only dog a player has is Cerebus. Enemy has access to both Cerebus and Hellhound. Those enemy Hellhounds have an initiative of 7, Cerebus has initiative of 9, and Frogs have initiative of 8. So, Cerebus goes before Frog, Frog goes before Hellhound.