Well, as I see it, there are
many people that do things that are contrary to their own best
interest. That is, indeed, why they do it.
When I was younger, I was a messed up little kid. I was one of those kids that hurt himself, and hid it, due to some unpleasant emotional problems. I knew that burning myself on my chest and stomach, out of view, was not a good idea. The same as with the cuts, pulling my eyelashes out (ouch), and pushing needles deep into my flesh.
I did these things with the express purpose of causing myself pain... You could, concievably, argue that I wanted the physical pain to erase the emotional pain, but that is a philosophical and psychological question that I don't know the answer to. I derived no pleasure from the act of hurting myself. On the contrary, it was very embarassing and I hid it because, at the time, I didn't have enough insight into my own actions to understand why I was doing it.