He technically was in a near death situation considering he had only 1 cell left and regenerated back his entire body, giving him a power boost just like Saiya-jin's
I think it was because he still had a part of his body left, which when regenerating took the damage that he had from his lower torso. That 1 microscopic cell that he had after blowing himself up created an entirely new body.
I don't know if Zenkais work by self inflict damage. There's Vegeta saying to Kuririn it wouldn't work by a self made injured, but there's also the narrator implying Goku got stronger through self inflict damage in his way to Namek.
Zenkais are received when the plot needs them, even if you're not near death (Vegeta vs Recoome), even if you're not even a Saiyan (Krillin
during Namek Saga).
It couldn't have been the beating. Cell said he never anticipated on being able to regenerate, calling the situation a miracle. The explosion was supposed to have been the end of Cell, so that was where the Zenkai came from.