Based on context alone, the interpretation stated in the OP’s question is problematic. Ezekiel 20:25-26 itself is a puzzling anomaly against the broader context of text. Apart from these two verses, the text otherwise forms one cohesive message that is first meant for the house of Israel (v.27) then to its children (v. 18). The two major points regarding what God desires from Israel are:
1/ They should abide by God’s commandments and keep holy his Sabbath (vv. 11, 16, 19-20)
2/ They should refrain from all idol worship and practices (vv. 7, 16, 18). Specifically, they are not to engage in child-sacrifice (v. 31)
Verses 25-26, however, break the flow of the text and present a problem for both translators and interpreters alike. An article by Jewish scholar Hyam Maccoby offers some valuable insight. Maccoby presents the problem in this way:
The difficulties of these translations are obvious. Ezekiel has just
been complaining that the Israelites have not kept the statutes and
laws. Now he says, apparently, that the statutes and laws were not
good. In that case, why complain that the Israelites did not keep
them? Or were there two sets of laws, one good, which the Israelites
did not keep, and the other bad, given to them as a punishment for not
keeping the first set? Where in the Torah or elsewhere is there any
evidence for two such sets of laws?
http://jtr.shanti.virginia.edu/statutes-that-were-not-good-ezekiel-2025-26-traditional-interpretations/#content
The various interpretations offer different solutions for reconciling this problem. Commentaries generally take the words of verse 25 literally. The problem with this approach lies in the challenge of explaining how God could give bad statutes and ordinances. Though commentators take pains to differentiate these laws from those of God (v.11), it does not resolve the problem that they are said to be given by God.
In the article above, Maccoby outlines an alternate interpretation belonging to Meir Loeb Malbim (1809-1879). Malbim interprets verse 25 as being sarcastic and as representing the views of those who rebelled against the laws of God.
Malbim’s general approach to the text, investing it with fierce
sarcasm, is surely far more convincing than the standard translations.
The notion of a God who deliberately gives bad laws is surely
nonsensical, but that Ezekiel should attribute to the rebels the view
that the laws of God, as conveyed by the prophet, are bad is perfectly
understandable.
Malbim’s interpretation hinges on an important textual issue:
It is in fact an important problem of the text whether the words
beha'avir kol peter racham refer to idolatrous human sacrifice or to
the Torah practice of sacrificing the firstborn of animals only. The
translators of AV and NEB have plumped for the former alternative,
while JPS leaves the matter indeterminate. In favour of the idolatry
alternative is the use of the same verb in a clearly idolatrous
context in v. 31. Also the use of the verb ha`avir in almost all cases
refers to idolatrous worship.
But there is an important exception, and this is certainly what
determined Malbim to adopt his interpretation. In Exodus 13:12, we
find not only the verb, but the whole phrase. Malbim was well aware
that Ezekiel is here repeating a liturgical phrase from Israelite
worship, and such a phrase cannot be ascribed to idolatrous procedure,
in reference to which the expression kol peter rechem is never used.
He therefore felt forced to interpret the rebellious Israelites as
complaining about the Torah law as an impediment to the performance of
idolatrous rites.
Actually, modern scholarship confirms the rebels’ sense of history, if
not their morality, for the biblical denunciation of human firstborn
sacrifice is now seen by scholars as a reform of previous Israelite
practice. The text of Exodus 13:12-13, while it rules out sacrifice of
the human firstborn, shows a law that has been subject to evolution.
The sanctification of the firstborn requiring redemption, the sparing
of the Israelite firstborn at the time of the death of the Egyptian
firstborn, even the aborted sacrifice of Isaac by Abraham, all show a
process of accommodation and reform bespeaking an original, primitive
pre-Biblical rite of firstborn sacrifice. The very fact that the term
ha`avir has survived in Exodus for non-idolatrous practice, though
elsewhere this term is used exclusively in a context of idolatry,
shows that there is more continuity between the two practices than was
later acknowledged. The biblical writers, including Ezekiel, denounced
human sacrifice as idolatrous (see especially the denunciation of the
Canaanites in Leviticus 21), but they were struggling with a mode of
worship that had an aura of ancient authority as well as a mystical
rationale of its own.
Maccoby’s article has helped me to come to my own understanding of Ez 20:25-26, one that deviates from those presented in the article. An additional excerpt from that article plays an important role in shaping my thought:
Malbim realised that Ezekiel was disputing with people who had their
own critique of the commandments of the Torah, rather than with mere
idolaters. But Malbim may have overlooked the extent to which
Ezekiel’s opponents were concerned with exegesis rather than criticism
of the Torah. There is also a question about how far the text of
Exodus was available to Ezekiel and to his opponents. This question
leads to the possibility that their dispute was not merely exegetical
but redactional: they may have been arguing about different versions
of Exodus current at that time, only one of which explicitly banned
human firstborn sacrifice (i.e. one contained Exodus 13: 13b, `and
every firstborn of your sons you shall redeem’, while another, cited
by Ezekiel’s opponents, did not).
“Ezekiel was disputing with people who had their own critique of the commandments of the Torah.” This point is important, I think, not just to the verses in question but to the chapter in general, the first verse of which states that the elders of Israel came to inquire of Yahweh. What they wanted to discuss may very well be the issue of child-sacrifice. This connection between their inquiry and the practice of child-sacrifice is more directly made in v. 31:
And when you offer your gifts, when you make your sons pass through
the fire, you are defiling yourselves with all your idols to this day.
So shall I be inquired of by you, house of Israel? As I live,”
declares the Lord God, “I certainly will not be inquired of by you. –
v .31
Here is my own creative reconstruction of the meeting between the elders and Ezekiel – The elders came to Ezekiel to challenge his teachings and interpretation of Scripture. Specifically, they questioned whether it was not Ezekiel who was wrong for denouncing the practice of child-sacrifice. Basing their arguments on certain verses from Exodus (13:12, 22:29) and possibly other versions of the Torah, they inquired whether this practice was not commanded by God himself. This is then how the “bad” laws came to be attributed to God.
“You shall not hold back the offering from your entire harvest and
your wine. The firstborn of your sons you shall give to Me." – Ex 22:29
God’s refusal to “be inquired” by the elders is an indication that they did not inquire in good faith but were only trying to justify their own position. Despite his refusal, the whole of chapter 20 in a way serves as God’s answer to their inquiry. Instead of debating the text, God’s answer lays out the history of his journey with the people of Israel, the focus of which is on God’s unwavering faithfulness and mercy despite Israel’s persistent unfaithfulness and rebellion (vv. 6-8, 13-17, 21-22). Against all the evidence of his holiness and goodness, God expressed his frustration that they still did not know or understand who he is.
Then you will know that I am the Lord, when I have dealt with you in
behalf of My name, not according to your evil ways or according to
your corrupt deeds, house of Israel,” declares the Lord God.’” – v. 44
Despite everything that I have written, however, I don’t think we can rule out the possibility that Ez 20:25-26 can be understood in its most literal sense. Though God, for the sake of his name, will’s only that which is good, there is still a sense in which everything that happens, whether good or bad, must serve God’s good purposes in the end. Thus, even when men rebel against God in the most egregious way, as when they offer up child-sacrifices to their idols, and even though sin is rooted in man’s own nature, intentions, and choices, their actions can still be said to be in accordance with what God has decreed. Herein lies the mystery beyond what the human mind can grasp - that of how God’s omniscience and omnipotence coexists with man’s free will. Easier to understand, perhaps, is how the consequences of men’s actions, the desolation that results from sin (v. 26), serve God’s will and purposes. In the end God proclaims his ultimate sovereignty over all things, so that all would “know that I am the Lord” (vv. 12, 26, 38, 42, 44).
“As for you, house of Israel,” this is what the Lord God says: “Go,
serve, everyone of you his idols; but later you will certainly listen
to Me, and My holy name you will no longer defile with your gifts and
your idols.” – Ez 20:39
As a final thought, I cannot help but notice how relevant the message of Ezekiel 20 is to answering the OP’s question. It serves as a reminder that, in order to properly understand and apply Scripture, we must first be grounded in the memory and knowledge of God’s goodness and mercy.