It was only about 300 years ago that humans realized about Gravity. Newton saw the apple falling and the insight came. Gravity was explained! Notice that gravity was explained not invented. Gravity itself has always been there. We just didn’t have a named for it. Apples have been falling off trees since the garden of Eden, but only 300 years ago there was the need to explain and document that as the “law of gravity”
When Abraham lied to Pharaoh in Egypt (Gen 20:2), does that mean he was not guilty because the 10 commandments had not already been written? …or when Joseph brothers sold him as a slave (Gen 37:12), was that okay just because the law was not given by Moses? Not at all…
You see, transgression started at the garden with Adam and Eve. They disobeyed first. Why no 10 commandments to them? Maybe because they could still speak to God face to face. After the fall however only Moses could speak to God face to face (Gen 33:11)…hence 10 commandments coming thru Moses.
Today, thru Jesus, we all can speak to God face to face, like Adam did, like Moses did. The law just points us to that fact. In Jesus we have the eternal promise that we can always talk to God face to face.