Ive heard similar thoughts from people having near-death experiences. Last one I remember was my brother having allergies without his epipen and could barely breathe and he talked about a similar feeling of inner peace.
I think it's somewhat similar to Meditation. When faced with a near death situation, your brain sort automatically gives you extreme "perspective" on things where you become "enlightened" for a moment. At least, that's my theory.
Thanks for writing this out, it was an interesting read.