The mind does not simply "play tricks".
The brain is not made to create imagery. Instead, the brain recreates visual input.
This means that there is always a source that the brain is recieving information from. The brain can't simply be creating all of this imagery on it's own without recieving information from a source.
Consciousness experiences reality by connecting through a brain. Consciousness is not simply the brain, it is rather plugged in to the brain and sensory information.
When someone has a near death experience, they are experiencing themselves, the consciousness, disconnect from the brain. It's not simply losing consciousness, their consciousness is just connecting to elsewhere.