There is a requirement in both Exodus 22:29-30 and Exodus 34:19-20 that people give their first-born sons to God. In both cases the offering of human sons is parallel to the offering of livestock in blood sacrifice. In the Exodus 34 passage you are required to redeem your son, apparently by offering a sheep instead, just as you would to redeem a donkey.
I doubt that the Exodus 22 passage ever was taken to mean actually sacrificing a son. Certainly the story about Abraham substituting a ram for Isaac projects the redemption of sons back to the beginnings of Israel. The Passover event also is about redeeming the firstborn of Israel, while the Egyptian firstborn were dying.
The strange passage in Ezekiel 20:25-26 (but then most every chapter in Ezekiel has something pretty strange) might mean that during the desperate days leading up to the Babylonian conquest of Jerusalem some fanatic had tried to interpret the Exodus 22 law at face value. Instances of actual human sacrifice seem to have been triggered by extreme events.
But the putting of people on the same level as livestock cuts against the grain of our modern thinking almost as much as human sacrifice. The reason, I presume, that you would not sacrifice a young donkey is that it was a beast of burden that you could use for many years to carry loads or plow fields. Its labor made it more valuable than a sheep.
I grew up the first-born son on a farm and did a lot of agricultural labor. So my cynical view is that sons and donkeys may have had similar roles and been valued for similar reasons.
Also I nearly died at birth and my grandmother told me many times that she had made a transaction with God in prayer, that if I lived I would serve him. So then I eventually ended up in the ministry. Did I really have any freewill about this?
You can see why I found this article by Eve Levavi Feinstein very interesting
She points to a passage that connects the offering of the firstborn with priestly service:
11 Yahweh spoke to Moses, saying, 12 “Behold, I have taken the Levites from among the children of Israel instead of all the firstborn who open the womb among the children of Israel; and the Levites shall be mine: 13 for all the firstborn are mine. On the day that I struck down all the firstborn in the land of Egypt I made holy to me all the firstborn in Israel, both man and animal. They shall be mine. I am Yahweh” (Numbers 3:11-13 WEB)
Then she further points to the ceremony for setting priests apart in Numbers 8:5ff.
Significantly, the Levites are presented as a kind of offering: the Israelites place their hands on the Levites’ heads, as one would do with an animal sacrifice, presenting the Levites as an “elevation offering” (tenufah). This suggests that in the eyes of the priestly author, dedicating a person to serve in a sanctuary was conceptually similar to dedicating an animal for ritual slaughter.
Feinstein also is co-author with Rabbi Zev Farber of this article, which further deals with Numbers 3 and 8. The authors suggest that in Numbers 3, Israel, after completing the census, consecrates all the first-born sons as Levites. This is confusing because Numbers preserves other, conflicting traditions . Here, however, it seems to make the consecration of the first-born as Levites a one-time event during the wilderness period.
That would suggest to me that the historical origin of the Levites might have been later and then written back into the wilderness. You could argue that the Levites did not exist at the time of the Exodus. So perhaps parents dedicated first-born sons (think of the story of Samuel) to serve at sanctuaries. Then this practice got projected back into the wilderness period.
That is apparently something like the conclusion of Mark Leuchter in his The Levites and Boundaries of Israelite Identity, a book that I hope to read soon.