The "ha-mashhit" (destroyer/death) was an evolving concept in Judaism. In some contexts it serves as a metaphor for YHWH in a role as destroyer bringer of death. In time it became a quasi-independent character acting as an emanation of God, the malik of death doing His will.
The Question of the killing of the firstborn is a complicated one requiring some hypotheses of the religion's development. It would seem Exodus 22:28 preserves an early requirement to offer the firstborn as a sacrifice. (Ex 13 parenthesis and 34 rewriting of 22 interjects the concept of redeeming not in 22). Numbers 18:16 defines the monetary value of 5 shekels of silver.
As sacrificing the firstborn in practice would be a great hardship, early on or concurrently the firstborn became offerings to the temple priests as labor. This then evolved into the Levites being interpreted as a substitute for the firstborns.
Numb 3:12 I hereby take the Levites from among the Israelites in place of all the firstborn, the first issue of the womb among the Israelites: the Levites shall be Mine.
Alternately, the story of the exodus from Egypt depicts YHWH as killing Egyptian firstborns as a substitute for the lives of the Israelite firstborn that had not been sacrificed as required. He is said to have consecrated (made holy) them by the deaths of the Egyptians. Number 3:13
So, it appears that some mnemic tradition of firstborn human sacrifice or dedication to cultic service inspired alternate explanations for this no longer being required. One solution was a monetary one, YHWH let you redeem your son with silver. Another, the killing of Egyptian firstborn as substitutes, another solution declares this arrangement replaced by the Levites. (Numb 3:12)
Interestingly the writer of this passage of Ezekiel was not a fan of the firstborn rules.
Ezk 20:26,26
I also gave them bad laws,
Laws that were not good
and rules by which they could not live.
When they set aside the first issue of every womb
I defiled them by their very gifts—
that I might render them desolate,
that they might know that I am Yhwh.