Is it

I’d say that either he is attention seeking or just showing affection, i’m pretty sure self punishment doesn’t come into it.
Thanks for the links Redvelvet