Welcome to the imperfect world.
People have kind of agreed to have governments, which create laws, which among other things set up punishments for crimes. There are multiple reasons for those punishments, including deterrence, revenge, keeping dangerous people away, and some amount of deservedness.
But if you look at the laws, there is no notion of "deserved punishment" in there. The laws says if you do this then you get that punishment. Not any reasoning why, just the relationship that a certain crime receives a punishment. All the arguing about the reasons has happened before the law was created. And any person is free to read the laws, and decide whether they want to commit some crime based on the punishment by the law (actually, most people decide on moral or ethical grounds).
Sure there will be different criminals who you might argue "deserve" a punishment to a higher or lesser degree. But that is irrelevant. The law doesn't care what each individual "deserves".
And "deserving" cannot be used anyway exactly because it is subjective. It's obvious that anyone who steals from me deserves the hardest punishment possible. Well, it's obvious to me. You and everyone else will disagree. Because it's subjective. The law doesn't care about this.