The way it was explained to me was that most land gods not related to Izanagi and Izanami were roaming demons that got beat by heroes/exorcist (?), and they were imprisoned so they are land-locked (?). Then the prayers made to appease them are what made them into gods that have power over that land
This is the Christian-based understanding of the Nihon Shoki and Kojiki that European scholars developed in the 18th-19th centuries. It's based on a backwards reading of the War of Descent where they try to equate it with the Christian War in Heaven narrative (think Paradise Lost). In their reading, the defeated Kunitsugami are depicted as rebels (therefore demons) against the power of the "legitimate" Amatsugami gods.
In actuality, the way the Japanese themselves read it is the other way around. The Japanese consider the Kunitsugami as the original legitimate gods of their ancestors and the Amatsugami as usurpers from the beyond.
This was very hard for Europeans to understand because in the official mythology the Amatsugami were the creator gods, the equal of the Judeo-Christian Yahweh. What they missed was that, in the Japanese understanding, the Yamato dynasty that claims descent from the Amatsugami themselves claimed to have been invaders to the Japanese isles (they weren't, but "invader mythology" is common among ruling classes in many civilizations). Therefore, the imperial claim to legitimacy was based on conquest, and likewise the imperial gods' claim to legitimacy was based on conquest rather than the creation myth.
Alternatively, whoever told you this may be talking about the specific case of "pacified" gods like Dara-san. However, this is actually a Chinese Daoist belief transferred to Japan in the Tang era. In Chinese Daoist/Buddhist belief system, demons and monsters can be pacified by enshrining them as gods and "cultivating" them (in Dao) or making them collect good karma (in Buddhism). The best example for this belief is the Monkey King and his friends, the demonic disciples of Tang Sanzang. However, these aren't the original divinities bound to the land that feature in native Japanese mythology. Those are Kunitsugami. There may be some confusion because the Kunitsugami are often depicted as monstrous animals, but that isn't because they're demons. It's really because they may originally have been deified animals or other natural phenomena when originally worshipped by the ancient Japanese culture, like the kamui of today's Ainu. As shown in this manga, usually pacified demon-gods are tied to their shrine, not specifically their land. That's why separate Yamatagi Madaras rule over the two sides of the mountain. The shrines are separated, not the land.