The "had to essentially work for the school doing e.g. grounds keeping and other tasks" seems problematic.
I’m also unconvinced that prison work is bad. Should they just hang out and do nothing? When tied to a shortened sentence, prison work seems just fine.
In the case of public schools using child labor for discipline one possible problem is that the children, if they were actually effective laborers, might tempt a school district to suspend more children to get more work done around the school, and possibly even reduce the number of maintenance workers they hire. You'd want such a system strictly regulated and audited to ensure this sort of thing doesn't happen.
Somewhat related: https://en.wikipedia.org/wiki/Kids_for_cash_scandal