>>50214682
>>50217113
So my main theory is that within Touhou, the Amatsukami were a "tribe" of gods who lived in a place called Takamagahara, which was presumbly high up on a mountain, but still part of Earth and affected by its impurity.
Upon realizing his mortality due to this, Tsukuyomi took action and formulated a plan to escape to a place (relatively) free of impurity.
In doing this, the Amatsukami descended from their mountain, which became known as the Tenson Kourin, wrested control of the land from the other gods through their superior power and technology (it's notable that the Lunarians make heavy use of technology instead of just divine powers, unlike the other gods we see in Touhou), sealed away any they saw as a threat to their power (such as Ookuninushi and Takeminakata), recruited any other gods they thought would be useful to them to join them on the moon, and forcefully bound into service any they thought they could make use of, regardless of their status, such as Yuiman, wholly unconcerned with morality because they think themselves far beyond the other gods, a mindset that would only grow stronger after they started living on the moon.
They would go on to shape the myths surrounding themselves to make them look better and keep the truth about the moon a secret, which led to the myths as we know them today, similar to how Eirin used Urashimako to seed a myth about a mystical "land of Hourai" which indirectly bolstered the faith in the Lunar Capital without revealing its secrets, solidifying its existence.