Cool, an excuse to slap 41 kids.
But, really, it's more of a social thing. Japanese culture is very heavily into social codependency, it's a vital pillar of their society. These young kids were exhibiting individual behavior, and at that point this teacher had a problem -- they needed to be brought back into the fold, and quick. Fortunately, this was a problem conveniently answered by socially fostered "loss of cool." This resulted in a "reprimand" that was probably more to smooth things over.
Isn't culture shock grand? Granted, the culture is attempting to embrace individuality more in recent years, but you can be sure there is a great deal of holding out going on.