Why? Genuinely asking. That seems like a proportional punishment to me, and certainly better than “detention” or whatever.
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