Many ancient cultures (and quite a few modern ones) have the notion of a high priest who represents the people. He goes through cleansing rituals and rituals where he/she takes on the identity of the people. Then he enters a place where ordinary people can't go, a sort of portal between two worlds. There he/she meets with an oracle, who in some of the oldest cultures is represented by someone of the opposite sex. They join together figuratively in the modern interpretation, literally in the older one, and thus are the two worlds reconciled. Sometimes a child is produced, a demi-god.
This evening I got to wondering where such an idea might have come from, especially considering how firmly it took hold across all of humanity. Here's what I came up with: think of very primitive, tribal, nomadic man. Some tribes would be much more powerful and wealthy than others, and being strangers with them could be very dangerous. They distrust and fear one another. The weaker tribe wants to join, or at least, get on better terms with the stronger one. They meet near each other, but keep their distance. A representative is sent from each tribe after being cleaned up and festooned with symbols of their tribe's wealth (the Hebrew high priest wore a breastplate with a jewel for each tribe of Israel). They meet in privacy in a central no-man's land, and if they take to one another, potentially produce a child which both of them have an interest in protecting. If the meeting goes well, the tribes are on good terms and everybody's happy.
I have no evidence for that wild hypothesis, but it seems plausible. Perhaps someone can point out a reference to something with a more historical basis.