Some laws seem to add insult to injury.
For example, laws which punish attempted escape, or resisting arrest. If one were very naive, or totally acquainted with modern legal systems, one might suppose that, to discourage escape attempts, jailers would simply punish those caught doing it. I'm sure they could find some way to do this without recourse to the legislature. Similarly, if the police encountered arrestees who resisted, they could, and probably do, deal with that in an effective way outside of the legal system and the courtroom. To add additional jail time to those convicted of these crimes, which may harm no one, not even the criminal, seems legal self-aggrandizement.