When reverting the turn, it goes to the player before the AI, even if the AI has been replaced with a real player

I have reverted the turn after the AI has been replaced with a real player.

But instead of the turn going back to the new real player, it went back to the player which made the turn before the AI.

Examples (see last comments):