Cause it’s disrupting the users chakra, like any genjutsu, and despite them being dead, the cadavers still had nagatos chakra to disrupt. This either caused the chakra controlling the cadavers to be disrupted, thus limiting nagatos control over them for the time being, OR nagato was under it as well.(I don’t remember if we see nagato at all during the fight with jiraiya so I’m not sure about the second one). Or at least that’s what would make the most sense to me
Even if the paths were actually caught Nagato could have simply disrupted or stopped the chakra transmission and then reboot it and everything would have returned to normal.
However, he didn't do that because getting caught and killed was part of the plan all along. Jiraiya was running the whole time, from the moment he realised he couldn't beat the three paths he started running. In fact, even before that he was running while he was trying to activate sage mode and Pein had to chase him around the whole time.
He stopped running after activating sage mode and fought for real, but quickly realised he was outmatched and started running again.
Pein needed him to stop running, and the only way to do that was for him to trick Jiraiya into letting his guard down. He went into that corridor knowing that it was a trap, with the intention to let the paths die so that the other three could catch him off guard.
If you pay attention to Animal's words before they went into the corridor and to Pa's words right after Jiraiya's arm got blasted, it become clear that that was the plan all along.
So I think he could have got out of the genjutsu by disabling the chakra feed to the paths and then rebooting it, but Jiraiya would have been suspicious if he did that and maybe figured out his secret, at the very least he would not have let his guard down and started running again.