That's a great insight.
I would point out that prison is still an acceptable in-between for community service and death. E.g. what happens if the convict simply doesn't show up for their community service?
Depriving someone of their own free use of their time is a powerful motivational tool (just ask anyone who's ever had to "hurry up and wait" in the military).
However any possible positive effect you would get from prison, either for rehabilitation or non-recurrence, would be had within the first year, two at the most.
Any prison sentence beyond that and you have to wonder what the marginal additional value is (I would think none).
I'm not sure if you're entirely serious about the death penalty for sufficiently serious crimes, but the normal argument is that even if that were acceptable in theory, that it's been proven not implementable in practice, and we'd rather optimize for not accidentally putting something to death who is innocent.
This itself could be fleshed out further though... governments all the times do things (or don't do things) that may indirectly lead to fatalities later on. Things as simple as redirecting a road away from a cliff face to prevent people from driving over the edge at night can save lives, but we as a population generally accept that there is an economic reality that government can't pay to completely prevent all foreseeable accidents. So could you argue from there that if we already let people drive off of cliffs because it's cheaper, that we could let government accidentally execute innocents if it had a net positive outcome?
I don't know... even I'm pretty leery of that logic. Personally if I were to be fradulently convicted I'd rather a lifetime of prison than to be put to death (assuming I could still read, program, etc.)