Cesar, on balance, is rewarded rather than punished in the end(Spoilers)
If Cesar was concerned about the continuation of his genetic line, than the knowledge that he has a beautiful, fertile granddaughter, is great news for him !
Sure he lost a semi-retarded, inbred nephew, with which he shared 25% of genes (since he shared 50% of genes with his brother). But he also shares 25% of genes with his beautiful & smart granddaughter (since he shared 50% of genes with his hunchback son).
Cesar might have felt a lot of guilt but at least he gained lots of hope. Had he only have an inbred nephew, who knows if he was ever marry and/or have healthy kids? So, guilty feelings aside, Cesar must have felt better off at the end of the movie, than the beginning. And since he was rather old, it wasn't such big deal for him to die.
So do we see any justice in the movie? Not really. The old man got his wish(i.e. genetic continuity) in ways he wasn't aware of, despite his failure to achieve them through his ignoble deeds.
Now if his granddaughter was killed or rendered infertile (e.g. through rape) by his retarded nephew before he committed suicide. Now that would have been true punishment !