God approving of child sacrifice?

Exodus 22:29–30

29 You shall not delay to make offerings from the fullness of your harvest and from the outflow of your presses.

The firstborn of your sons you shall give to me. 30 You shall do the same with your oxen and with your sheep: seven days it shall remain with its mother; on the eighth day you shall give it to me.

Ezekiel 20:25–26

25 Moreover I gave them statutes that were not good and ordinances by which they could not live. 26 I defiled them through their very gifts, in their offering up all their firstborn, in order that I might horrify them, so that they might know that I am the Lord.