Thanks for being as helpful as always.
Unfortunately, if even pause was not working, then I don't know what could cause this bug. The pause screen is inefficient but reliable because it's state is checked every single frame, and the only way pause stops working is if the game over/victory flags are set, which shouldn't be the case in the second to last level. Even then, if those flags are somehow set, the corresponding ending screen should show.
My best guess is that this is caused by some issue in a third party dependency I have, but some of those dependencies recently had a major release, so I think they're probably too unstable to upgrade/migrate to atm. They were also rather unstable while working on this project. So, I'll update the dependencies for this project at a later point in time, but otherwise, yeah, unfortunately, I don't think I can fix this.