Staying within your religious context, this practice is known as
Mortification of the flesh is an act by which a individual or group seeks to mortify, or put to death, their sinful nature, as a part of the process of sanctification.
In Christianity, common forms of mortification that are practiced to this day include fasting, abstinence, as well as pious kneeling.
Another example of mortification of the flesh is self-flagellation.
A related, and complementary, concept is asceticism, which, as opposed to doing something one finds distasteful, is forgoing or abstaining from things one would like to do.
Asceticism is a lifestyle characterized by abstinence from worldly pleasures, often for the purpose of pursuing spiritual goals.Wikipedia
An alternative to asceticism, suggested by @Cerebus in the comments, is ascesis, which I like better than asceticism because it seems more personal, more of a practice specific to that one individual.
Finally, a common conversational rebuke in these contexts is:
Oh, don't be such a martyr!
Which @Matt S cleverly reduced to martyrdom.