seems cruel and unusual…

Unusual? Only because we've made it so. Cruel? Nah. Locking someone up because they're criminally insane is less cruel than letting them roam the streets, both to the perpetrator and the people around them.