let's not ignore the fact schools were designed long ago to 1/ shape future factory workers into well behaved blue collars, while 2/ making it possible for parents to go to work.
before the industrial revolution, most people were farmers. Kids were out playing, stayed home safe or participated to gardening activities.
the issue with school is far more deep rooted into how our society sadly operates. it may be impossible to fix one without addressing the other.