If Psalm 119 is true, what "law" is Galatians 2:21 referencing?
Short Answer: A partial response to this appears here.
First, suppose we observe the N/T passage in question:
Galatians 2:21: "I do not nullify the grace of God, for if righteousness comes through the Law, then Christ died needlessly."
Paul is here referring to the Law of Moses. To paraphrase: "[If] righteousness comes through the Law of Moses, then Christ died needlessly." That Law paved the way for the perfect Law: the "Law of Christ" (Gal. 6:2). To avoid misunderstanding about this:
Galatians 6:2: "Bear one another’s burdens, and thereby fulfill the law of Christ" (emphasis added).
God gave the Old Law to the Israelites many centuries before the birth of Christ (Deu. 5:1-5). However, this law was never intended to be permanent; it was formally fulfilled upon Christ's death on the Cross, meaning no more carnal sacrifices ever again needed to be offered (He was the ultimate Sacrifice).
Some may find this unpalatable, however, when Christ cried out from the Cross, "It is finished!" (Matt. 27:50-51), the veil of the Temple was torn in two. What did this mean? Well, because the "veil of the Temple" was a barrier between God and Man, there could never be any direct contact between the two. The veil excluded everyone (but the high priest, and he only once a year) from the Presence of God in the Holy of holies.
The Law of Moses was to be praised, for it was righteous. Unfortunately, no human being (except One) could keep the Law perfectly. Thus, bloody sacrifices (typifying the ugliness of sin) were crucial for salvation as they looked forward to Christ's Sacrifice. Of course, without Christ's Sacrifice, all other sacrifices were meaningless.
[ Note: Throughout the patriarchal period, many men offered sacrifices to God: Abel, Noah, Abraham, Job, etc., because the male head of the household was often considered its "priest", one allowed to do so prior to Moses and the Law.]
Christ's death changed that. He tore the veil from top to bottom, allowing us to speak to God through Him, as our High Priest. He is now our path to God the Father, allowing us "in Christ" to pray and have our prayers heard (and answered) by the Almighty without a physical high priest — and without bloody, carnal offerings.
However we decide to translate the many passages pertaining to the Law of Moses in the N/T, there can be little doubt that the Mosaic order was reinstituted in a more perfect form upon the inauguration of the new priesthood, one in which all saints partake as priests and saints (cf. 1 Pet. 2:9, temples: 1 Cor. 6:19).
No matter how one decides to parse the Greek: plērōsai, the Law of Moses was fulfilled, or completed, or supplanted, or superseded by Christ.
Israel (as with David) rightly held the Law of Moses in the greatest esteem, just as it should have been. Naturally, anyone suggesting otherwise would be met with contempt. Nonetheless, as God, Christ was very deliberate in His announcements early in His ministry of His relationship to the Law of Moses. He would thus fulfill the Law in every respect when, upon His death, He "paid off the debt" by fulfilling it.
He did this through: 1) His perfect obedience; 2) His manifestation as the Messiah; 3) Extending His teaching, thus lifting His Law (Law of Christ) to new heights — thus, superseding Old Testament teachings, and 4) Nailing the Law of Moses to the Cross (Col. 2:14).
In Matthew 5, Christ repeatedly announces: "You have heard it said…" followed by "But I [now] tell you…" Christ is fulfilling the Law while at the same time declaring that His new law is about to supersede the old one upon His resurrection. The rest of the N/T, inspired by the Holy Spirit, would complete all of the New Law, thus supplanting the Old Covenant with the New one, which is how we should understand the great esteem with which the Old Law was held.