The punishment of one persons sin upon their children is pertaining to national judgments. It means our sin does not only effect us but as it enters society, if it goes unrepentant of, it is like a cancer invading the whole body. Eventually a whole nation can suffer the eventual downfall and judgment as a result of the sins of a forefather hundreds of years later.
God's management of peoples and nations and their unavoidable interaction and community, sharing both the blessings and judgments of God, does not contradict his dealings with each individual as accountable for their sin on it own ground. Neither does he want men to suppose they can be gods and seek vengeance on the innocent for another man's sin.
I think the best way to understand it is in how we actually see God in his dealings with the world and especially Israel. With Israel God predicted Israel's future failure at the very commencement of the Law. It was predicted that they would not retain the land they would enter on account of idolatry and other sins. Furthermore he warned them of this through Moses with specific results in various places, for example:
I will scatter you among the nations and will draw out my sword and pursue you. Your land will be laid waste, and your cities will lie in ruins. Then the land will enjoy its sabbath years all the time that it lies desolate and you are in the country of your enemies; then the land will rest and enjoy its sabbaths. (Leviticus 26:33-34, NIV)
When we actually trace the sins that eventual leads to this 'visiting the iniquity of the fathers on the children' generations later, we see it takes time and the fathers who sinned almost seem to get away with it and only the children suffer. For example we might say idolatry started with Solomon but while he lived in the greatest luxury, his children following his example and continuing in his sin, eventually paid the price. In fact just as many of our children suffer divorce starting long before they feel it, during the time a man decides to look at another woman with lust in his heart with a premeditated commitment of pursuing it into a kind of grave, Solomon's many foreign wives and his love for them made him less opposed to idolatry.
However although God is patient and slow to bring about his judgments, the judgment actually happens instantly from an internal death, and loss of true enjoyment of God, or at least a diminished measure of it. This loss of an inward enjoyment of God is in many ways a greater loss and judgment, even in prosperity, than the eventual physical manifestations of a leaders sins affecting a nation only outwardly. One is personal the other national. In fact God can gives life to his people while they suffer national calamities, so inwardly they are blessed while appearing to suffer judgment. We highly underestimate this 'fruit of sin', the inward loss of joy, because we know little of God's glory to begin with. We do not even notice it depart! What should be our primary motive for obedience is dismissed as irrelevant.
In any event, God's just hand pursues sin from its source and chases it along generations not letting it go unaccounted for. However as we are individually judged upon our own deserts and none other, than even our undeserved blessings or curses that we enjoy or suffer due to our station in life, will be included in God's measuring of our own selves before him. in any case we must, in our own civil laws, ensure a criminal is never punished for the crimes of another as God hates injustice.