The kid the ref is trying to restrain/get off the ice has his hand pulling down at the refs collar. That's a no-no in my books. Should the ref have slapped him? Absolutely not. But it wasn't unwarranted.
The kid..one of the smaller ones..typically trying to prove something, is also jostling back with the ref. You don't know what may have been said or what the kid may have done which you can't see from the camera angle or continuity of the event.
That certainly doesn't excuse the ref if he has lashed out, but refs can make mistakes under pressure, be inexperienced , be subject to threats of verbal abuse or whatever. Regardless, the ref was predominantly try to break it up and remove the player from the fracas, who looked like he wanted to just keep going.
Players at that age have more than enough time to learn and now to behave towards refs. My sympathy is towards the ref, because whatever he might have done or tried, it didn't look like it would have caused any damage. Players are easier to replace than refs.
If I was a ref or in charge of organising them, if there weren't serious sanctions for those players who jumped in, that school would be without refs for their games for a while.