The sacrifice of the firstborn is the foundation for the building of the house. There was such thing as Canaanite foundation sacrifices, of which archaeologists have found proof (whether coins or animals or even humans). It is hard to determine whether that is what happened here, since the curse of death was itself pronounced by the Lord, the true God, in Joshua 6:1–27.
34 In his days Hiel of Bethel built Jericho. He laid its foundation at the cost of Abiram his firstborn, and set up its gates at the cost of his youngest son Segub, according to the word of the LORD, which he spoke by Joshua the son of Nun.