That's an intriguing view of religions. Comparative mythology already demonstrates some unifying themes, and Jung interpreted that unity along psychological or phenomenological lines.
I'd be inclined, though, to view religions as having historical connections, beginning with shamanism and religious/entheogenic experience. So I'd combine an overall theory of religion with one of meta-history. I'd say, for instance, that theism eerily foreshadows our transhuman potential, almost as though myths were blueprints that we reify but eventually implement via secular humanism and technoscience. (Some links below.)
That seems consistent with your suspicion about religion's underlying purpose. Are you hinting, however, at a more conspiratorial view of ancient astronauts?
I can't say I'm familiar with the Yoruba, but judging just from the Wikipedia page, their religion would seem to be animistic, so I'd interpret it as an unintended blueprint for, or foreshadowing of the technoscientific re-enchantment of nature (the creation of an artificial domain that slays the dragon of the outer, godless, amoral, absurd wilderness). Animists view nature as full of meaning; technology and culture make it so.
http://rantswithintheundeadgod.blogspot.ca/2013/09/mythopoesis-and-consolation-of.html