The sacrifice of firstling animals and redemption of firstborn sons were originally not related to the exodus story. When they were linked to the tenth plague, the narrative was adjusted to have YHWH also slaughter the Egyptian firstling animals.
The Priestly Torah has two different conceptions of why/how the firstborn Israelites are exempt from serving as priests. Is a questionable firstborn census an effort to weigh in on this dispute?
Eve Levavi Feinstein