How did buddha-nature thought develop?

From Buddha-Nature

The theory of buddha-nature (tathāgatagarbha, for the most part)--that all sentient beings somehow possess the innate buddhahood or potential to become buddhas--seems to have appeared in India as early as the Second Century CE before spreading to China and Tibet and beyond. The concept seems to have initially been taught as a means of inspiration, offered in response to the seeming nihilism of Madhyamaka emptiness-theory, as well as to the Yogācāra doctrine of Three Natures which restricted buddhahood to only a select few. For this reason scholars mostly agree that buddha-nature theory developed alongside--rather than part of--the two main Indian Mayāyāna Buddhist doctrinal schools, and great thinkers of each have both embraced it and rejected elements of the teaching. Buddha-nature was taught in a handful of early Mahāyāna sūtras such as the Mahāparinirvāṇasūtra and the Śrīmālādevīsūtra, and systematized first in the Ratnagotravibhāga, a treatise composed before the year 498 (when it was brought to China). From there it appears to have permeated most Buddhist schools, becoming a significant topic of debate among them.