Ezekiel 18 addresses false ideas about children paying for the sins of their parents. It teaches individual responsibility. Jesus also focuses on each person’s responsibility before God. Neither do people enter Heaven just because they are culturally Jewish or Christian. As John the Baptist said, God can raise up children of Abraham from the rocks of the earth.
Instead of trying to match the New Testament to the narrow wording of Deuteronomy 5:10 or the earlier expression in Exodus 20, it is more fruitful to see where Jesus speaks more broadly about the Commandment against idolatry. Paul the Apostle speaks on several occasions about “The Law of Christ”. We can see that law of Christ in Matthew.
The commandments may be split in ten (the normal way) or in fourteen, as they are expressed as fourteen imperative statements. The section with the mention of visiting punishment upon the third or fourth generation is in the third imperative.
Matthew consists of twenty-eight chapters. Each pair of chapters matches one of these imperative statements. Thus that Gospel is intentionally modeled after the commandments. The third imperative matches Matthew 5-6. In Matthew 5, instead of speaking negatively against the idolatry of false worship like the commandment, Jesus speaks positively for the heart attitudes of true worship. The Beatitudes are that expression.
Like a fractal, the whole of the Ten Commandments are visible in Matthew 5. There are nine blessings and one call to rejoice, for ten statements in all. Each beatitude matches its corresponding commandment, though some loosely. Thus the final call to rejoice in the heavenly reward is the antidote for coveting your neighbor’s stuff. The ninth beatitude about those who “persecute you and utter all kinds of evil against you falsely on my account” matches the commandment against bearing false witness.
The match for the second commandment against idolatry is “Blessed are those who mourn, for they shall be comforted.” (Matthew 5:4, ESV) Idolatry is worshiping what you have (possessions, money, power) as though it is a God that can save you. True worship is entering the House of Mourning, as Solomon puts it in Ecclesiastes. The consciously empty person turns to God to be filled.
Matthew 6 elaborates on many of the commandments, like murder, adultery and vain oaths. That chapter speaks about seeking heavenly treasures, not earthly ones, which are our idols:
No one can serve two masters, for either he will hate the one and love
the other, or he will be devoted to the one and despise the other. You
cannot serve God and money. (Matthew 6:24, ESV)
The proper understanding of the three and four generational curse requires a lot of analysis of Old Testament Prophecy.(I am currently writing a book on this topic and it addresses this passage in detail.) It is important, but for the Jews, I believe it had already come to pass by Jesus’ day. The Jews had broken the covenant and suffered the covenant curses, including the ones related to this commandment. Thus Jesus had no need to reiterate the part of the command related to a curse whose expression in the dawning age of grace would be different.
On the flip side, Jesus speaks abundantly about the love of the Father, from the promised rewards In the Sermon on the Mount, to the Lord’s Prayer to other expressions. The passage about asking God for blessing says it all:
Ask, and it will be given to you; seek, and you will find; knock, and
it will be opened to you. For everyone who asks receives, and the one
who seeks finds, and to the one who knocks it will be opened. Or which
one of you, if his son asks him for bread, will give him a stone? Or
if he asks for a fish, will give him a serpent? If you then, who are
evil, know how to give good gifts to your children, how much more will
your Father who is in heaven give good things to those who ask him!
(Matthew 7:7-11, ESV)