EDIT: There's a passing mention to it in Mark Edward Lewis' history of the Tang and something a bit more detailed in Dieter Kuhn's history of the Song. They talk about people amputating part of their bodies for some religious purpose.
Jimmy Yu wrote his dissertation on self-harm in China in the 16th and 17th centuries, of which an edited version was later was published under a different title. He states that these actions predate this time, but that the period is significant in that it was when these sorts of actions became popularly sanctioned. Examples are widows cutting of their noses to avoid being remarries, self immolation, a son writing a letter to the emperor in his own (the son's) blood to beg for his father's pardon, and children feeding parts of their own flesh to ill parents to show their piety.
Yu describes their prevalence as follows:
The prevalence of these practices can be attributed to the economic prosperity, the increase in literacy, the production of numerous works that explored human passion and subjectivity, and the repercussion of progressive and changing intellectual and moral discourses that began in the 15th century and peaked in the 16th and 17th centuries. These changes reconfigured the way people related to their own bodies and cultural values"
He ads that the practices were not at all limited to religious spheres, despite that being the typical view (Buddhism specifically), but rather that people from all walks of life and all religious or secular backgrounds are recorded as having taken part in such acts. In addition, their reasons for doing so were varied.
As per your question, this does not specifically address how such practices initially developed, but is more focused on their popularisation and reasons for the spread. As for how they first came about, that might be a question for /r/askanthropology. At any rate you'd probably need to address that going back to prehistory.
edit: I've not read the Mark Edward Lewis or Dieter Kuhn texts, but I imagine it may be referring to the filial piety issue. The practice is called gegu 割股 and usually it was removing a part of your flesh, but not full on amputation. If you can provide a quote (otherwise i'm looking for one now) I might be able to help address that specifically.
edit 2: I've got a copy of China's Cosmopolitan Empire: The Tang Dynasty by Lewis. One of the primary reference to religious mutilation is as a criticism of Buddhism and its foreignness. To quote:
the passionate mutilation of the body by burning or chopping off fingers and limbs that figured in the public worship of Buddhist relics echoed the use of self-mutilation to demon- strate grief in non-Han mourning rituals. (p.175)
Also:
Next came the Buddha’s birthday on the eighth day of the fourth month, when Buddha images were bathed and paraded through the streets. In certain years the rarest relics of the Buddha, most notably the famous finger bone (which has now been discovered in a crypt beneath the Famen Monastery, near Chang’an), were carried through the capital in a procession that triggered mass hysteria and the sacrificial burning of heads or arms. In 873 a soldier chopped off his own arm and held it in his other hand as he followed the procession. The last important festival was All Souls’ Feast, on the fifteenth day of the seventh month, to commemo- rate Mulian’s rescue of his mother from hell. (p.217)
However Yu's work (above) mentioned that this was not actually entirely limited to Buddhism. This leads me to question the likelihood that the criticism of Buddhism for these acts was entirely objective.
At any rate it's also something that has occurred in other cultures throughout history, so I'm not sure we can say for sure how it developed in China specifically.
Sources:
Sanctity and Self-Inflicted Violence in Chinese Religions, 1500-1700. Yu, Jimmy. Oxford University Press 2012
China's Cosmopolitan Empire: The Tang Dynasty. Mark Edward Lewis. 2012