Deuteronomy is “full disclosure” from God. It speaks both to obedience and its consequences and disobedience and its consequences. There are blessings for obedience and curses for disobedience:
…And you shall be plucked off the land that you are entering to take possession of it. “And the Lord will scatter you among all peoples, from one end of the earth to the other, and there you shall serve other gods of wood and stone, which neither you nor your fathers have known. (Deuteronomy 28:63-64) [ESV]
Historically, the disobedience Moses predicted and the consequences happened. However, this raises a new question: what righteousness is available to people who were disobedient and suffer the consequences? Is there any hope for them?
The Greek translation (LXX) of Deuteronomy interprets 6:25 different than the literal text:
If we are watchful to perform all these commandments before the Lord our God, as he has commanded us, there will also be mercy for us." (Deuteronomy 6:25 NETS)
καὶ ἐλεημοσύνη ἔσται ἡμῖν ἐὰν φυλασσώμεθα ποιεῖν πάσας τὰς ἐντολὰς ταύτας ἐναντίον κυρίου τοῦ θεοῦ ἡμῶν καθὰ ἐνετείλατο ἡμῖν κύριος
And it will be righteousness for us, if we are careful to do all this commandment before the Lord our God, as he has commanded us.' (Deuteronomy 6:25)
וּצְדָקָה תִּֽהְיֶה־לָּנוּ כִּֽי־נִשְׁמֹר לַעֲשֹׂות אֶת־כָּל־הַמִּצְוָה הַזֹּאת לִפְנֵי יְהוָה אֱלֹהֵינוּ כַּאֲשֶׁר צִוָּֽנוּ׃ ס
The LXX translator(s) understood the Hebrew term וּצְדָקָ֖ה which means righteousness as ἐλεημοσύνη which means "mercy, pity, especially as exhibited in giving alms, charity; the benefaction itself, a donation to the poor, alms."
The Hebrew text is “righteousness.” However, it is obvious from the LXX, Hebrew scholars before the Christian era already interpreted Deuteronomy 6:25 differently. Most likely the failure of the nation to obey the Law which led to the scattering (fulfilling Deuteronomy 28), led them to understand righteousness as mercy.
This is what Paul states:
For in it the righteousness of God is revealed from faith for faith, as it is written, “The righteous shall live by faith.” (1:17)
For what does the Scripture say? “Abraham believed God, and it was counted to him as righteousness.” (4:3)
Inherent in the Hebrew text of Deuteronomy is the concept man, obedient or not, being made righteous by God. Essentially, it requires faith to believe God will make a sinful man righteous under any circumstances; thus the righteousness of God is always from the mercy of God. One living after the consequences of disobedience, still attempts to be obedient but in the mercy of God with the continued hope for the righteousness of God (by faith), which in reality, was the start of the obedience/disobedience cycle.
Paul did not change Deuteronomy. Just like the LXX translator(s), he made explicit what is implicit in the concept of righteousness from God. The advantage for Paul is the sacrifice and resurrection of Christ Jesus which leads to the belief Christ was the end of the cycle. Man can now put their faith in the tangible evidence of God's righteousness and His mercy.