There never was a pathway to salvation through works.

Adam and Eve demonstrated this in their works after the fall.

When Moses addressed the Gospel in Genesis he talked about the Abrahamic covenant which was the salvation covenant. The mosaic covenant was not a covenant of salvation.

Moses, and this is repeated by Paul, stated that Abraham, as the father of faith, believed God and that this belief was counted as righteousness. That declaration, that salvation is through faith, was declared hundreds of years before the Law was given. Both testaments declare the same truth.

The reason the law was given was to compound sin and guilt. Not my opinion just simply what scripture teaches. The law was not given as a means of righteousness, the law being the 10 commandments. The law cannot bring any righteousness period. It can’t because men cannot perfectly keep the law at any point.