among girls, I dare to assume, everything came from pro-ano ladies who wanted to lose a lot of weight and were inspired by anorexia. For the extra few calories they ate accidentally / on purpose, they punished themselves by leaving deep and not very cuts with a razor in places where, in their opinion, they had an imperfect body.
Well, then they usually grew up and instead of "how to become anorexic" they googled "ointment for scars". Verified.
I think that such a fashion has been from time immemorial. For example, in the Middle Ages, it was customary among priests to lash themselves to blood for their sins. Voluntarily. As if punishing yourself and atoning for your sins with this.
In fact, it is something like a masochistic desire to punish yourself. To punish for some kind of offense that is "in principle" or only in the head of the masochist himself.
Samurai generally had hara-kiri (seppuku), as far as I know. But they have different reasons. Mostly when their honor as a warrior is hurt.