Let’s say we were back in the 1960’s and rage against blacks was still strong in the south. Would it be “nonsensical” to punish crimes against blacks a little stronger, in order to achieve the desired social goal of a society where people of all colors can be safe and secure?
Probably not.
reasonable people can disagree about who should be protected a bit more when to further which societal goal, or even if it shoudl be done, but it’s not irrational.