Kids must attend school to get basic education. When government mandates attendance, it does not mean that they can use it as excuse to take other rights away.
In voluntary activities no related to necessities, there possibility to make stricter rules, because people don't have to be there.