I think of the brain as a "rationalization machine". It observes environmental inputs, and reflexively seeks to ascribe a cause for those inputs. In so doing, a causal model of the world is constructed (whether accurate or not), allowing the agent to make intelligent decisions about what actions to take in order to produce desired outcomes.
What hallucinogenic drugs tend to do is overwhelm the brain with sensory inputs that are sui generis and cannot be folded neatly into a pre-existing causal model of reality, but that are so numerous that they cannot simply be ignored.
So the "protective mechanism" of the brain, rather than abandoning or risking damage to this highly valuable causal model of reality, is to shunt these experiences over into an "other" category of mystical and religious significance. The fact that these experiences are inexplicable, rather than being an indication of any "malfunction" in the brain which might prompt us to doubt our perception in general, is instead proof of their cause: the incomprehensible divine.
This isn't academic, just my 2c.