Jeremiah 7:31 – Does the Lord deny that he ever commanded child sacrifice?

Jer 7:31 ‘They have also built places of worship in a place called Topheth in the Valley of Ben Hinnom so that they can sacrifice their sons and daughters by fire. That is something I never commanded them to do! Indeed, it never even entered my mind to command such a thing!’ (Emphasis added)
Jer 19:5 ‘They have built places here for worship of the god Baal so that they could sacrifice their children as burnt offerings to him in the fire. Such sacrifices are something I never commanded them to make! They are something I never told them to do! Indeed, such a thing never even entered my mind!’ (Emphasis added)
These texts are understood by some to teach that God, having once required child sacrifice (in Ex 20:29f) now denies that he ever did so.
I dispute that the text in Exodus requires child sacrifice. But even if it did, Jeremiah is railing against a very different kind of practice. The Exodus passage, if it is about child sacrifice at all, is about offering the firstborn son to the Lord. Jeremiah, on the other hand is speaking out against the sacrifice of children (sons and daughters) to Baal. The passages in Jeremiah have nothing to do with the passage in Exodus, far less abrogate it.
Christopher Hays (in The Widening of God’s Mercy) agrees that, in the end, child sacrifice is banned. It is banned in the law codes (Lev 18:21, 20:3; Deut 12:30–31; 18:10), and condemned by the prophets (Jer 7:31; 19:5–6, 11; cf. 2:23, 3:24; Ezek 16:20–21; 20:25–26, 30–31; 23:36–39).
But this banning of child sacrifice took time, according to Hays. Ex 22:29-31 represents, he writes, the earliest promulgation of the Mosaic Law, and it itself bracketed by (later) laws which state that firstborn sons should be redeemed, and not sacrificed.
Hays concedes that:
‘There is no evidence, in the text or in archaeology, that children were regularly sacrificed in ancient Israel. As we have seen, many laws went unspoken, and it is entirely possible that the redemption of the firstborn was the unwritten norm early on and only later did child sacrifice need to be explicitly prohibited. If so, this probably took place in the reign of Josiah, who “defiled Topheth, which is in the valley of Ben-hinnom, so that no one would make a son or a daughter pass through fire as an offering to Molech” (2 Kgs 23:10). The sacrifice of male children on the eighth day may later have been sublimated in the practice of circumcising them on the same day (Lev 12:3). (Italics original, bold type added)
Quite so; but I doubt, for reasons already stated, that either Ex 22:29 or any other text mandated child sacrifice in the first place.