It is not unusual for someone to inflict upon themselves something uncomfortable or painful as a result of intense emotions. The historical occurrence of people using sackcloth and ashes is often associated with the intense grief people can experience.
One might expect that Aspergers neurological variant resulting from a more complex, sensitive, or faster neurology would also amplify the intensity of emotions such that things other than grief might also compel one to such acts.
The management of reactive emotional intensity can be challenging. With anger, taking time to calm down or use physical activity such as taking a walk can be helpful. If one is propelled by emotional intensity to take physical action, it might be useful to substitute an alternative action such as exercise, tearing pieces of paper, or wringing a towel.
Attempting to apply management techniques to existing habits may take some practice as alternatives may be attempted in the midst of established reactions and only slowly come to be a more complete substitute.