And so it turns out, religion was fabricated to provide meaning, however artificial, to empty pointless lives. The meaning of existence, unfathomable, was conceived by mankind, to provide a basis for continued existence. A purpose was invented, and a final goal.
People were simply unable to accept that existence was the product of a rare accident. Human existence, in essence, was and is no more important than the existence of the lowest of microbial life.
The base purpose is nevertheless, the accumulation of knowledge about the material universe, hampered only by the quest for knowledge about the unknowable spiritual realm, which may not even have existence at all.