I don't agree with the kids who jumped the ref for hitting their teammate, because it's too much like vigilante justice for me to condone it, though I understand that they were in a very heated situation and may have felt that they were protecting their teammate. Given their developmental stage (human brains aren't actually done forming during the teenage years) and the competitive, emotionally charged environment I assign them less blame than the ref. Not of this justifies what they did, but it does mitigate it.
The ref should not have slapped the kid. As the adult and the official, he should have possessed the emotional control not to resort to violence (hitting instead of separating the player as is typically done by officials) and the foresight to see that his behavior was only going to make a bad situation worse. He should have known that slapping the kid was only going to escalate the situation and could easily be construed as child abuse. Although child abuse laws vary, I can tell you that it's probably not a good idea to slap a kid like that if you aren't the parent (and really even if you are the parent). It's pretty unfathomable that someone living in modern society with all the concern about child abuse wouldn't realize that the optics of a ref slapping a child aren't good.
The ref was very much in the wrong, and it actually is somewhat appalling to me that he is only being suspended two months. The ref had a responsibility to maintain order and he very much failed at it; his actions brought about more chaos because of his violence and rashness, and since he is the adult and the official, we would expect more from him than from teenagers and players.