According to the MacArthur Bible Commentary Exodus 20:5,6
means that children “would feel the impact of breaches of
God’s law by their parents as a natural consequence of its
disobedience, it’s hatred of God. Children reared in such
an environment would imbibe and, then, practice similar
idolatry, thus themselves expressing hateful disobedience.
Three year-olds would tie in the idea that the blood covenant lasted three generations. After the blood covenant, you see many references to the God of Abraham, Isaac and Jacob. So the blood covenant was perpetual but did not pass into the fourth generation