I'm guessing that this god mode works not by disabling collision with player-killing objects (like it's meant to be done) with the existing player object, but instead switches the player object to the invincible one, and the code wasn't built to take that into account.
As far as the code is concerned, the player doesn't exist.
Can't even get god mode right smh