If you don't understand what you did was wrong, like at a fundamental level, you won't understand the punishment. It would be cruel and unusual to punish someone for something they thought was OK.
Imagine you don't understand murder, at all. You see other people as meat bags no different than cattle or a worm. So you kill one, because you're hungry, or they had something you wanted.
No, someone comes along and arrests you and puts you in jail, they say it's punishment for being bad. You're confused and upset. Forever.
Now, replace my "imagine you..." scenario with a completely legal action, like eating breakfast. Imaging you are arrested and put in jail for life, for eating breakfast, or some other inane, legal action.
That's what it would be like to punish someone truly insane.