Did the major religions arise from old guys going into the desert without water and getting heatstroke?
From personal experience, I can tell you that heatstroke and spiritual experience are two very different things. The major religions arose from the ruling classes wanting to establish and maintain control over the masses. If you compare the traditions of the religions with the Holy Scriptures they claim to be based upon, you will find that not only are they not in harmony with them, but in many cases in total and complete contravention to them.
You seem to be thinking of major monotheistic religions. This wouldn’t apply to Eastern religions. In the case of Islam, Christianity, Judaism and Zoroastrianism, going into the desert, i.e. a very harsh environment which is very testing and free from distractions from everyday life is a very good way of getting closer to God and listening to the inner voice. Assuming they did get heatstroke, who is to say that wasn’t God’s way of revealing the truth to them, just as epilepsy might be? Just because something is going on in your visual cortex, that doesn’t mean you aren’t seeing something, and just because strange things are going on in your brain, that doesn’t mean it isn’t a perception of something real.