Was there Law before the Commandments given at Sinai?
The Commandments, the Decalogue, were simply a reiteration, with some specificity via codification, of the moral law of conscience (Romans 2:14-15) that has been extant as an arbiter of free will since the creation of the angels; after all, it is this moral law that judged the sin of Satan and that same moral law judged the sin of the Noahic generation where all but eight were destroyed by water.
All of humanity is created with God’s basic moral law infused within them and that moral law is arbitrated by the conscience. In the New Covenant, that same moral law is arbitrated by the indwelling Holy Spirit through the conscience for those who have trusted in Jesus as Lord (Galatians 5:16). Those who die apart from the Law Covenant will be judged by the moral law of conscience; those who die under the Law Covenant, will be judged by the Law of the Covenant (Romans 2). Those who die in Jesus as their Lord will NOT be judged by law as Messiah is the end of the Law for those who believe as Messiah’s righteousness has been imputed in the life of the redeemed by grace (Romans 6:14; 2 Corinthians 5:21).
The Law of the Covenant concerning morality was nothing novel or new but simply codified in writing certain specific behaviors as particularly abhorrent to God as the Law Covenant, given specifically to the Hebrew Tribes, reflected God’s holiness and the holiness expected of Israel’s children as they were set-apart for God’s purposes within the Realm of Time and a people group through whom God would introduce His Messiah to the World (Leviticus 21:8); essentially, the Law Covenant was a school-master or tutor pointing Jacob’s children to their need for Messiah’s atonement by faith as the Law defined sin void atonement (Galatians 3:24; Romans 3:20).