Not only were the Ten Commandments given to the people of Israel after they were redeemed from the land of Egypt, the “tablets” that were written on were broken before Moses delivered them to the people (Exo 32:19).
The Torah was supposed to be a way of life for the newly redeemed people, that they might “be for (God) a kingdom of priests and a holy nation” (Exo 19:6). As a result of their failure to obey God, the Jewish people were subjected to a variety of disciplinary measures—but God NEVER rejected them! That is something that He specifically said He would never do (Lev 26:44; cf., Psa 94:14; Rom 1:1-2).
Therefore, we too can be “confident of this, that he who began a good work in (us) will carry it on to completion until the day” that the Messiah comes. (Phi 1:6)