Probably because the goal is to discourage parents from being cavalier about the subject and hopefully to keep peanut products out of the cafeteria.
The normal kid can just come to school with a different sandwich if he wants to have the run of the cafeteria. The kid with the allergy is already going to have a difficult circumscribed life, it would seem to be most charitable to show some consideration and not make him seem any weirder. He has no way of escaping the quarantine.
By definition, charity can't be ordered or forced.