It's not a question of owing anyone rehabilitation. The problem is that most people who commit offences are damaged in some way, usually traumatised when they were children. Sex offenders were often sexually abused themselves as children. So incarcerating them doesn't help with any of this, it just traumatises them more. If you release them without trying to help them come to terms with their own trauma you are just creating more victims when they reoffend.
This is the reality of the situation. Although it sounds like a plan to leave them in the desert somewhere I don't think you really think that is practicable do you?
Prison should be a mixture of 1. consequences so that victims feel that their suffering has been recognised, but also 2. attempts to rehabilitate offenders simply because not to offer this, tempting though it is, does not address the underlying causes.
For Governments to free up money for this isn't an easy sell. It's an easy target for the tabloids. So we keep going around the offending/incarceration/reoffending loop.
There are no easy answers that I can see.