The sacricial system for sin seems to be in place even as far back as the garden when God told Abel and cain to provide an acceptable sacrifice in Genesis 4.
Later, when God lays out the sacrificial system for the tabernacle, we see the High Priest there to sacrifice for individual sin on an as-needed basis and we also see the establishment of the Day of Atonement / Yom Kippur for the nation. That system included the sacrificial goat and the scapegoat.
Having the benefit of time and the enlightenment of Holy Spirit, we now see that that system was a forshadowing of the ultimate sacrifice for sin: Jesus / Yeshua the Messiah.
In this episode Parson Rayphe discusses the Day of Atonement and how it is God’s mechanism to atone for the sin of man-kind.