I dunno about this. There are many many many biblical examples of God literally doing this. Everything from ham, to esau, to Cain, to generations of israelites in Iran, to generations of Israelites in Syria, to generations if Israelite in Egypt, to generations of israelites under Roman opression, to even the reason your cousins live in Cleveland or Atlanta instead of the garden of Eden. I'll stop here for now, but I think you get my point.
And this is before quoting verses like Dueteronomy 5:9 , where God himself tells you that he will punish countless innocents for the deeds of their grandfathers.
Why can't we just accept God exactly the way he is presented in the Bible, instead of picking and choosing his attributes ? I worry that we stray into idolatry by exalting the portions of God that are pleasing to the wishes of man.