So are there any Mahayana texts which support this idea of "purifying karma" or is it just an idea that Vajrayana teachers borrowed from the Jains and Hindus?
i am from the Pureland tradition which is from Mahayana. One of the ten common doubt is as the following that talks about purification of karma. The dark house analogy is especially enlightening.
Question 8 http://www.purelandbuddhism.com/10Doubts.pdf
From time immemorial, sentient beings have committed countless transgressions. Moreover, in this life, from infancy to old age, they create additional evil karma because they do not have the opportunity to encounter good spiritual advisors. Under these circumstances, how can it be said that "At the time of death, they will achieve rebirth with only ten perfect utterances of the Buddha's name"? Furthermore, how do you satisfactorily explain the teaching that such practitioners "transcend the binding karma of the Triple Realm"?
In truth, it is difficult to assess the number or the strength of the good and evil kamic seeds that sentient beings have created from time immemorial. However, those who, at the time of death, encounter a good spiritual advisor and accomplish ten utterances, must have created good karma in the past. Otherwise, they could not even meet a good spiritual advisor, let alone accomplish ten pure recitations!
Now, lest you think that the evil karma from beginningless time is heavy while ten utterances at the time of death are light, I shall cite three reasons why rebirth in the Pure Land does not necessarily depend on the weight of bad karma, the amount of practice or the duration of cultivation. The three reasons concern a) the Mind, the conditions and c) the issue of certainty.
The trangressions committed by sentient beings spring from deluded, perverse thought. Recitation of the Buddha's name, on the other hand, arises from right thought, that is, hearing of Amitabha Buddha's name and true virtues. One is false and the other is true. There is no possible comparison between them!
This is similar to a house which has been boarded up for ten thousand years. If the windows are suddenly opened to let the sunlight in, all darkness immediately dissipates. However long the period of darkness may have been, how can it fail to disappear? It is likewise for sentient beings who have committed transgressions for many eons but achieve rebirth at the time of death through ten pure recitations.
Transgressions grow out of dark, inverted thoughts, combined with illusory circumstances and environments. Buddha Recitation, on the contrary, arises from hearing of Amitabha Buddha's name and pure virtues, combined with the aspiration for enlightenment. One is false and the other is true. There is no possible comparison between them!
This is analagous to a person struck by a poisoned arrow. The arrow has penetrated deep inside his body and the poison is strong, deeply wounding his flesh and bones. Still, if at that moment he hears the "celestial drum", the arrow will "shoot out" of his flesh by itself and the poison will be neutralized. The arrow has not penetrated so deep nor is the poison so strong that he cannot recover! It is likewise for sentient beings who have committed transgressions for many eons but achieve rebirth at the time of death through ten pure recitations.
c) Certaintiy of Salvation
When sentient beings commit transgressions, they do so enter from the "intervening mental state" or "post-mental state". These two mental states do not apply, however, at the time of death: there is only one extremely powerful, utterly intense thought of recitation, letting go of everything before dying. Therefore, rebirth is achieved.
This is analogous to a very large, strong cable which even thousands of people cannot break. Yet, a child wielding a "celestial sword" can cut it in several pieces without difficulty. It is also similar to a huge pile of wood, accumulated for thousands of years, which, when set on fire by a small flame, is completely consumed within a short time. The same is true of someone who has practiced the Ten Virtues throughout his life, seeking rebirth in the Heavens. If, at the time of death, he develops an intense perverse thought, he will immediately descend, instead, into the Avici (Never-Ending) Hell.
Although bad karma is intrinsically false and illusory, the overpowering strength of Mind and thought can still upset a lifetime of good karma and cause the individual to descend onto evil paths. How, then, can Buddha Recitation, which is true, wholesome karma, generated intensely at the time of death, fail to upset his bad karma, even though that karma may have been accumulated from time immemorial? Therefore, someone who has committed transgressions for many eons, but, at the time of death accomplishes ten recitations with a totally earnest Mind, will certainly be reborn in the Pure Land. Not to achieve rebirth under such circumstances would indeed be inconceivable!
The sutras teach:
"A single utterly sincere recitation of Amitabha Buddha's name obliterates the grave wrongdoings of eight million eons of Birth and Death."
This is possible because the practitioner recites the Buddha's name with a Mind of utmost sincerity and therefore can annihilate evil karma. As long as, on his deathbed, he utters the Buddha's name in such a frame of Mind, he will be assured of rebirth. There can be no further doubt about it!
Traditionally, it has been explained that the dying person's ability to recite ten utterances is due entirely to previous good karma. This explanation is not, however, correct. Why is this so? It is because, as a commentary states, "if it were merely a question of previous karma, only the vow for rebirth would be necessary, and there would be no place at all for practice ..."
The practitioner who, on his deathbed, accomplishes ten recitations, is able to do so because of his previous good conditions (enabling him to meet a good spiritual advisor) and because of his own wholehearted recitation. To attribute rebirth in such circumstances exclusively to previous good karma would be a great mistake! I hope that practitioners will ponder this truth deeply, develop a firm Mind, and not be led astray by erroneous views.