L.B.
A child that hits himself when confronted with a disagreeable situation is NOT faking or trying to get attention. Your son hits himself because he is has reached a level of frustration that is beyond his control.
The "spoiling" thing is the key here. Your son has learned that manipulation will get him everywhere. This is not a good thing!
My boyfriend and I have had temp. legal guardianship of my grandson, who just turned 4, since he was around 2 1/2. Up until then, he had been in an unstable environment, a witness to frequent domestic situations, all stemming from unhealthy psychological manipulative behavior, and it's results, and had never experienced a consistent schedule of wake, nap, bedtimes, etc.
He hit himself many times when faced with accepting our calm, but insistent rules and demands in our efforts to create a safe and consistent environment for him.
We didn't make a big deal of it, most times just ignored it, and occasionally suggested calmly that he stop hitting himself and left it at that. I should add that he possesses an almost unbelievable (sometimes even eerie), extremely advanced amount of comprehensive and intelligent awareness, of all he sees and hears. I believe this is due to his memory skills. For instance, before his 2nd birthday, I showed him some object and told him it's color name was "aqua". Months later, during which time the word "aqua" was never referred to, he remembered and used it to describe the color of a different object!
There were some very stressful times, but we agreed that it was important to be consistent, stick to the goal of creating an environment of stability, which included a strict schedule when it came to nap and bedtimes, etc.
I did speak to the pediatrician about his habit of hitting himself, and he said it was not an uncommon behavior, and we were doing the right thing by ignoring/downplaying it.
My suggestion for you is to put an immediate stop to any spoiling by others, which is only reinforcing the undesirable fine art of psychological manipulation.
Be consistent, and let him know that he is responsible for his own actions and decisions. For instance, at bedtime, when my grandson makes a big fuss, he is given the choice of either laying in bed for a few minutes with light on and a book, or lights out, no book. Note that whichever one he chooses, the outcome of going to bed is the same!
It took close to a year, but my grandson did stop hitting himself when frustrated, and has accepted the fact that trying to manipulate us to get is way is a lost cause!
Good Luck! Hang in there!