Just a theory: The brain probably subconsciously predicts death when it is basically a sensor for your entire body, when it does predict it, it triggers something basic in nature, looking forward to something that will happen and non materialistic and basic in nature.