Imagine if when you were born, the brain needed some kind of imprinting, by looking at the stars. So traditionally, newborns would be brought outside and let watch the sky for a few hours.
The brain would be set up to turn genes on and off based on what was going on in the sky. The position and phase of the moon would be important, as well as planets and bright stars.
In a world like this, people born on the same day really would have something similar, bonding them together. The appearance of a supernova would affect an entire generation, bringing them together. There'd be minor similarity cycles a month long, based on the moon.
Eventually, people would experiment with artificial skies, primitive stonehenges with holes in the roof in a certain pattern. Newborns would be left there, their sight controlled and all imprinted with the same pattern. They'd try different patterns, and villages would be bound together by their shared imprinting box. Empires would form with copies (possibly not exact) of "good soldier" patterns - and there'd be a royal line, too. Peasants would be forbidden from experimenting with witchcraft, but occasionally new patterns would emerge from barbarian lands. Hidden cults would form, secret, hiding and experimenting with dangerous patterns.
Later, there'd be attempts to recreate the star pattern the night famous people were born. Having been shown the same input would be a powerful way to bond - and letting your kids get random input would eventually be viewed as outdated, and taking a huge risk. Your pattern would be part of your resume - and imprinting discrimination could be a problem.
Something like this could have evolved in humans. Some people think the option for becoming a sociopath is a latent ability of everyone, that's triggered when a young child detects that that might be the best way to survive in their environment. Sometimes the brain needs a source of randomness, and maybe this would evolve as the way to get it.