A combination of nervous tension and habit at this point, and it does provide you with some relief. %his appears to have become your preferred way to manage stress or frustration.
It is extremely difficult to stop a bad habit. But, changing or altering a bad habit can be far less challenging.
My suggestion: start wearing a rubber band around your wrist. When you next get stressed, overwhelmed or frustrated, instead of dig in at your back, snap the rubber band painfully against your wrist. Do not expect to remember to do this consistently at first, but after awhile this may become your new coping mechanism being used consistently, and is far less damaging than your present practice.
To avoid getting stressed or overwhelmed and frustrated in the first place, you might consider learning and practicing relaxation techniques such as meditation and doing calming routines (such as working on simple puzzle books when you feel nervous tension is building up).
Where do you get excited? The pain or seeing blood or both? If you say yes to any or all of these I think you might want to consult a therapist.