The argument that we cannot determine what constitutes a just punishment is an argument that all punishment is unjust and the State cannot punish anyone for anything. That argument doesn’t apply solely to capital punishment.
True, and justice is very much a part of the common good, but you have just asserted that we cannot know what constitutes a just punishment.
I think you’ve misinterpreted what he said if for no other reason than that there is no such thing as an intrinsically good act. Any act, if done with a bad intent, becomes a bad act. The church gives just such an example:
1755 An evil end corrupts the action, even if the object is good in itself (such as praying and fasting “in order to be seen by men”).
I don’t dispute this. The point to understand here, however, is that determining what act best serves the common good is a judgment, therefore people may legitimately hold contrary opinions and there is no moral distinction between the positions.