No teacher or parent likes to see a child suffer the consequences of bad behavior. If a child knowingly does something dangerous, that child typically receives a consequence to demonstrate that the behavior is problematic, and to help teach the child not to repeat that behavior.
While it's hurtful to watch your child suffer a consequence, it's much worse to diminish the meaning that consequence has. We can be compassionate to our children by acknowledging how painful it is to endure a consequence, but we also have to be honest with them by letting them know how dangerous their behavior was, and how lucky they are to have this opportunity to learn now rather than to continue using a dangerous behavior, the kind of behavior that could hurt someone.
When parents and teachers allow children to suffer the consequences of poor behavior, they do help children to learn what's right and what's wrong, and they save children from more painful and hurtful negative behavior later on. Better that a ten-year-old endure a school consequence for purposely breaking, taking, or mis-using an item then get in the habit of doing that later on when the consequence can be jail time, missed opportunities, or fines.
Of course, this area of child life has to be treated with utmost care and respect. Consequences need to match the problem so a child can truly learn from their mistakes or misdeeds. And, we have to make sure we have the supports in place to help children do better. We need to think about children's misbehavior as opportunities for teaching rather than punishment. To simply punish children with no compassion, teaching, or learning, is to set a child up for failure. When children misbehave, there's typically underlying reasons that need to be understood to help that child do the right thing later on.
This is not a simple area of good parenting or teaching, but it is an area we have to be aware of and collaborate around to help children positively develop as much as we can.