C.,
I agree with Tysca: it is 'immediate karma', you hurt others, you get a hurt back... only, as you are mom, you can hurt him veeeeeery gently and slightly and most compassionately: like squeezing slightly your son's hand, so that he feels it is very uncomfortable but not really hurts. He won't want this feeling, so he will quit doing what causes it - which is hitting you.
Pulling hair => same thing. If he will ever grab your hair again, grab onto his hair ever so slightly and push very gently, so that he feels discomfort, not real pain, and as soon as he will loose his grip, let his hair go immediately.
While you do this unpleasant exercise, use the same set of words every time: "no, it hurts! NO, IT HURTS!" short and always the same, because then one day you will just say these words, without applying this karma-exercise of slightly hurting him back, and he will already remember what these words are connected with.
I believe you will be great friends very soon again!
Thank You C. wih trusting mama-source site, I am amazed how many caring people share their experience here, it is the friendliest mama-site, ever: so, if any problems, at all, come here again, we have a great mama-community here and always try to help with more ideas...
Let your day be good, C., hugz to you and your little Treasure! :)