When a body is injured it will release endorphins in the body as a natural form of defense. So you will get a high from that and the physical will distract you from the emotional pain, which is a relief. So its very easy to understand why you do it. It is also a habit. I used to do it and as the years went by it got less and less. I hardly ever do it now but the thoughts still pop in at times, but not for long.
When the urge to do it comes along try and do something else. Do something physical which will also help the body to release endorphins. Go to the gym or have a walk/run. Clean the place where you live. Or get outside of the house as a distraction. I'm sure that your therapist has come up with suggestions as to alternative actions.
Kicking any habit that reduces emotional pain is hard, but doable as you get better.