Hi Sleepy:
See if this article helps you get a grip on the behavior (pun intended).

In all seriousness, from what you describe, the behavior is one that no longer has a legitimate function but serves only to numb you out from your feelings. The end result is keeping you in a cycle of self-defeating behaviors, from what it sounds like.

The more you feel bad about this, the greater the self-loathing and greater likelihood of repeating what temporarily feels good but leaves you unempowered.

Hope this helps.
Good luck

Blissfully retired after 35 years treating sexual abuse