In covenant relationships and in matters of inheritance, we gain access to things we neither deserve nor ask for. We receive salvation because of what others have done. Abraham gave his son and so God gave his son. We partake of Abraham’s inheritance and we reign with Jesus Christ.
It is a hard thing to accept morally, that people are then punished because of what others have done. (Deuteronomy 20 and 1 Samuel 15, for instance.) There are stories in the Bible where God delays his wrath, only to take it out on a generation that knows little about what their forbears did. It is strange. It is not humanly moral but perhaps it is godly righteous.
If we are to accept the concept of unmerited favour, we must also find a way to also accept the concept of unmerited punishment.
“Therefore, just as through one man sin entered the world, and death through sin, and thus death spread to all men, because all sinned—(For until the law sin was in the world, but sin is not imputed when there is no law. Nevertheless death reigned from Adam to Moses, even over those who had not sinned according to the likeness of the transgression of Adam, who is a type of Him who was to come. But the free gift is not like the offense. For if by the one man’s offense many died, much more the grace of God and the gift by the grace of the one Man, Jesus Christ, abounded to many.” Romans 5:12-15