(Yithro 20:2) "I am the L–rd your G–d": Why were the ten commandments not stated at the beginning of the Torah? An analogy: A man enters a province and says (to the inhabitants): I will rule over you. They respond: Did you do anything for us that you would rule over us? Whereupon he builds the (city) wall for them, provides water for them, wages war for them, and then says: I will rule over you — whereupon they respond: Yes! Yes!
I Am the Lord Your God Why Were the Ten
Mekhilta Tractate Bachodesh 5:1