“The Law”, is often interchangeably called the Law of Moses, and the Law of God. God gave it to Moses, whom then gave it to the Israelites.
Obviously, Israel Specific commandments would not have existed prior to Israel, but the whole law is not centered around Israel & the Exodus.
2 Chronicles 34:14
Hilkiah the priest found a book of the law of Yahweh given by Moses
Psalms 103:7
He made known his ways unto Moses, his acts unto the children of Israel.
The contents/requirements of the Law of God/Moses existed in some form before it was written down by Moses and given to the Israelites
-the Sabbath was made holy at creation, and existed prior to the Israelites
-Noah knew The difference between clean and unclean animals
-Onan did not go into his sister in law after his brother died, thus God killed him for not continuing his brother’s lineage
-Abraham obeyed Gods “commandments, statutes and judgements”
-the Sodomites were wicked in God’s sight. Those who do not live according to God’s law are wicked
Psalms 119:53
Horror hath taken hold upon me because of the wicked that forsake thy law.
Proverbs 28:4
They that forsake the law praise the wicked: but such as keep the law contend with them.
Genesis 26:3-4
And I will make thy seed to multiply as the stars of heaven, and will give unto thy seed all these countries; and in thy seed shall all the nations of the earth be blessed; because that Abraham obeyed my voice, and kept my charge, my commandments, my statutes, and my laws.
Nehemiah 9:18
Thou camest down also upon mount Sinai, and spakest with them from heaven, and gavest them right judgments, and true laws, good statutes and commandments
Psalms 147:19-20
He sheweth his word unto Jacob, his statutes and his judgments unto Israel.
He hath not dealt so with any nation: and as for his judgments, they have not known them. HalleluYah.
There is nothing to indicate that the “laws, statutes and commandments” given to Israel(Abraham’s children) are completely different from the “laws, statutes and commandments” given to Abraham(Israel’s father)
Exodus 20:6
And shewing mercy unto thousands of them that love me, and keep my commandments.
Did God suddenly change his commandments to a different, brand new set revealing them to the Israelites? We have no evidence of this.