You omit the fact that prison sentence is determined by a judge on a case by case basis. The principle for detainment is to protect the public.
But a prison sentence is also a terrible tragedy because it affects the perpetrator for the rest of their life.
I’m no psychologist but it seems there is a certain “will to criminality” that exists in some people. It is a defect like sociopathy. Others may commit crime out of desperation. Others still, by accident. I think the first type is irredeemable, needs some jail. The second and third might not need prison but might be “unreliable” to have around in emergencies, if you know what I mean.
They could all perhaps be reformed, but not in a prison.