I've worked in many types of prisons in more than one country. Female and male provision (and mixed youth). If you removed from prison:
Anyone with a head injury (in women this is almost always DV)
Anyone with a learning disability
Anyone coerced or controlled
Anyone neurodivergent (particularly ADHD)
Anyone seriously abused as a child
You'd be down to a pretty small number and of those almost all would be a combination of addicted, mentally ill and bereaved. I did a project once in youth corrections and a timeline with the offenders. There was NO young person in the group who hadn't lost a close person (dad, mum, brother, sister). Not one.
Prisons are places we warehouse the humans we didn't bother to help before they broke. Rehabs/treatment are also full of bereaved people and those abused as children.
It's not rocket science. Reduce abuse, reduce DV, deal with cognitive differences well, give people bereavement counselling, you'd empty prisons.
None of these things is voluntary. These situations were forced on people. And yes some people suffer and don't offend. But that's a combination of luck, neuroplasticity and confounding variables. Not goodness.