As humans evolved, religion is simply the earliest form of a law when man began to evolve to become "civilized".
Religion evolved into written laws.
The energy based lifeforms that use living tissue as a host also evolve.
It is the energy based lifeform (soul) that keeps proliferating and evolving along with the evolution of living tissue that may be what comes to be judged someday as worthy to move on to other things.
Because of the almost infinite size of the universe with its almost infinite number of planets it also likely contains an almost infinite number of intelligent lifeforms.
Because there is an almost infinite number of types of lifeforms it is likely some of these lifeforms are energy based lifeforms that use living tissue as a host....being its soul.
It is the soul that is deemed if worthy of having evolved to satisfactory specifications to join the rest of the energy based life at the end of its evolving (reincarnating).