While Paul denied in Romans 4:1-5 that we can earn our righteousness even as the result of having perfect obedience to the Law of God, he also affirmed in Romans 2:13 that only the doers it will be declared righteous (Romans 2:13), so there is a reason why our righteousness requires us to choose to be a doer of the it other than in order to earn our righteousness, namely faith insofar as the faith by which we are declared righteous apart from works done in order to earn it as the result also upholds the Law of God (Romans 3:28-31). It is false that the the only reason that someone could have for obeying the Law of God is in order to become justified, but rather that reason has always been a fundamental misunderstanding of its goal.No one can be justified by keeping the old covenant. New covenant believers follow Christ and the Holy Spirit and their standards are higher than that of the old covenant; so if someone follows the old covenant rules, they're trying to be justified by a system that God has already declared inferior.
The Son is the radiant of God's glory and the exact likeness of His character (Hebrews 1:3), which he embodied through his works by setting a sinless example for us to follow of how to walk in the Spirit/how to walk in obedience to the Law of God, so the way to follow Christ and the Holy Spirit under the New Covenant is by following his example, which is the same as the standard of the Mosaic Covenant (Jeremiah 31:33, Ezekiel 36:26-27).