The purpose of a justice system is to provide justice- to return the victim of theft or aggression to a condition as close as possible to their condition before the violation occurred.
The justice system doesn't exist in order to teach anyone a lesson. Not that you'd know that anymore.
If a lesson is learned by the bad guys in the course of providing justice, that is just icing on the cake, but it isn't necessary. If restitution is required enough times, and if shunning follows an offense, and if an intended victim's self defensive violence is upheld as correct and justified regularly, then bad guys have a choice to make: learn a lesson or keep facing consequences, including the very real possibility of being killed by the next target.
When the perverts who populate legislatures, enforce "laws", and sit in judgement in courthouses try to use the justice system to teach people a lesson justice is thrown out the window. Those idiots in government try to pervert the justice system to teach drug abusers that they shouldn't use (not just abuse) "drugs". Those parasites in government try to wield the justice system as a club to teach people that they must comply with, and assist, The State in its theft of their property. The justice system has been stolen to be used as a way to impose the twisted desires of government psychopaths on you and me. Justice isn't even a goal any longer; punishment is. And the excuse used is that "we must teach these people a lesson". Balderdash.
Most people brought before the courts aren't even there for anything that concerns a real justice system at all. And those who are... well, there's a very good chance the only reason they have fallen into a life of theft and/or aggression is due to the criminal assembly line the "justice system" has become for those who dare to assert their self-ownership in ways The State forbids.
Justice isn't possible in a system that has been stolen by the bad guys, to be used by the bad guys, to teach the rest of us to do as they demand we do, or ELSE! Insist, and enforce, a separation of court and State.