When it comes to translated words, it doesn’t always follow that derivative words must absolutely hold to the root word of the translated language.
• δωρεαν - gratuitously
Derived from
• δωρεά - gift
Derived from
• δῶρον - gift made sacrificially, offering
The adverb in English gratuitously is defined as
being without apparent reason, cause, or justification
So if we exchange the Greek word δωρεαν for this definition in the verse in question we get
“I do not nullify the grace of God, for if righteousness were through the law, then Christ died (δωρεαν - without apparent reason, cause, or justification) for no purpose.”
Galatians 2:21
To answer the underlying question by the OP
”Does it mean that salvation would be achieved through law also, without the Gospel?”
Firstly I would substitute gospel there with grace.
Not a chance! For righteousness belongs to God and it must be imputed to the created,(especially sinful, helpless, mortal men).
“We have all become like one who is unclean, and all our righteous deeds are like a polluted garment. We all fade like a leaf, and our iniquities, like the wind, take us away.”
Isaiah 64:6
For righteousness that can be acceptable to God must be of God. God is pure, His righteousness is likewise pure
“I will get my knowledge from afar and ascribe righteousness to my Maker.”
Job 36:3
The whole book of Job circles around this almost fatal mistake of Job, who failed to ascribe God’s righteousness to God but assumed it to himself and it cost him dearly
“So these three men ceased to answer Job, because he (Job) was righteous in his own eyes.”
Job 32:1
If the law could have saved Job, then God would not have dragged blameless and upright Job through the crucible, but precisely because Job was blameless and upright according to the Law but NOT righteous, did God in His LOVING kindness exposed Job to the filthiness of self righteousness and it’s deceiving saving illusion. The Law is not what saves a man, FAITH in what God has to offer saves sinful, helpless, mortal men.