@Hailey Great question I think it is important to remember that Abraham and Moses were not the first people to walk with God or to receive commandments from God. God gave Adam and Eve a very specific command and both Cain and Abel offered sacrifices to God on an altar. The line of Seth in Genesis traces the line of godly men who followed the true God down through the ages even as wickedness spread upon the earth. And in Abraham’s day Melchizedek was a priest of God Most High. In the words of Jesus, “Before Abraham was, I AM”.
No doubt the godly people who lived before Moses often talked about the importance of obeying God and walking in His commandments, without referring specifically to the law of Moses. I do not think this reference presents any fundamental difficulty no matter what period of history Job lived in if we remember that God has always been at work among the human race. God has spoken at many times and in various ways throughout all of history.
Hebrews 1:1 - In the past God spoke to our ancestors through the prophets at many times and in various ways, 2 but in these last days he has spoken to us by his Son, whom he appointed heir of all things, and through whom also he made the universe.
Hope that helps
Verse 12. - Neither have I gone back from the commandment of his lips. Professor Lee rightly observes that this declaration “takes it for granted that, at least, some precepts of God had been revealed before this time” (‘Book of Job,’ p. 370). Them were “commandments” which Job recognized as having proceeded from God, and “words” which he looked upon as being the utterances of his mouth. This is strong evidence of a primeval revelation which, if not reduced to writing, had, at any rate, been handed down by tradition to Job’s day. Genesis 3:14-19 and Genesis 9:1-7 may afford the true explanation of this difficulty. I have esteemed the words of his mouth more than my necessary food. This is scarcely strong enough. Job says, “I have treasured up taken to myself, and preserved the words of his mouth,” either “more than my necessary food” or “more than my own law.” If the former rendering be preferred, there is no need of explanation; if the latter, we must regard “my own law” as meaning “the law of my own mind, my own will, the will of the natural man” (Cook). Pulpit Commentary