Moses didn’t write the Ten Commandments; God did. And Paul affirms that the problem with obeying them does not lie in a problem with them, since they are right, and holy, spiritual, and good as he tells us in Rom 7, but the problem is with man. Man must be united with God, obeying by the power of the now indwelling Holy Spirit, with a righteousness that comes from Him on the basis of faith and not on the basis of the law (Phil 3:9), in order to have the obedience that he was created to have. As Augustine put it, “God wrote on tablets of stone that which man failed to read in his heart.”
But revealing that law, as we know, actually had one main, particular purpose: to convict us of sin, to teach us of our inability to be righteous and holy…apart from God. Because “Apart from Me you can do nothing” (John 15:5). But with Him we can produce much good fruit. Merely obeying by the letter, as the Pharisees did and as Paul excelled at as a Pharisee, himself, even if it was somehow done perfectly, is meaningless. It makes no one holy; it cannot and does not justify anyone because that would only be a pretense of holiness to begin with. The real thing comes as we become grafted into the Vine, now reconciled with and in union with God as man was meant to be from the beginning. We become ‘His people’, and then He ‘puts His law in our minds and writes it on our hearts’ (Jer 31:33). And we become His people, entering into that vital, life-giving and just union with Him, by faith. And Jesus came to reveal and reconcile us with that God, a God truly worth knowing and believing in.
The law He writes on our hearts is love, which opposes sin and does God’s will, fulfilling the law (Rom 13:10), by its nature. Without that, we aren’t even His (1 John 3, etc).