I think the least bad option is to let allow people to make mistakes and learn from them. How would you feel about sending people to prison for eating junk food, smoking a cigarette, drinking a beer, wasting time on social media/watching netflix? And afaik countries that have decriminalized drugs and focused on harm reduction actually end up with less drug addicts. Its also worth noting that most cases of overdoses are caused by the drug either being cut with something stronger or the user just taking too much due to high inconsitinsies in purity with each purchase
imo the risk of convicted child molesters having a hard time finding jobs involving children despite being deemed rehabilitated by some beurocratic organization is preferrable to the risk of giving them ample oppertunity to molest more children, unless it could be scientifically demonstrated with great certainty that the rehabilitation program was completely effective in like at least 99.99% of cases (how would you even falsify this hypothesis given how many victims choose not to speak out?).
Similarly i would not want people such as bankers or politicians convited of corruption/fraud or similar things being in positions where they have significant influence over the economic conditions of millions of people without proper supervision (which clearly is there is not)
The strategies for dealing with criminals should really vary depending on the type of crime thats been commited i think, as others have pointed out i think your views on this are too black and white