Also note that this re-ordering affects the "pre-battle" order, and doesn't reflect any changes to party order due to moves used in battle... It seems like the game is trying to restore the party order from before the battle but is shifting the party lineup by one place when doing so.
Viewing post in Ero Dungeons [Old Version] comments
I had the impression that the post-battle party lineup is influenced by the characters and their classes and levels. At least it only changes once I level up or switch one of my characters and also returns to the previous lineup as soon as I switch back. Otherwise I can see little logic behind it. It doesn't depend on hp and durability, but it seems to prefer prisoner, cleric or rogue at the forefront