One of the key verses used to defend the Protestant doctrine of justification by faith alone is Galatians 3:10:
For all who rely on works of the law are under a curse; for it is written, “Cursed be everyone who does not abide by all things written in the Book of the Law, and do them.” [ESV]
Proponents of "faith + works" justification often argue that "works of the law" in this verse actually refers to the ritual or ceremonial law, not to the entire Mosaic law, in spite of the word "all" in Paul's quotation.
J. Gresham Machen critiques one such opponent of sola fide and calls his commentary on Galatians "medieval," saying that this sort of exegesis is "a return to the religion of the Middle Ages" (Christianity and Liberalism, 121). In at least one sense he's right, since this was the typical understanding prior to the Reformation. But his implication, perhaps, is that this view was not held in the early church.
So my question is: when do we first see an explicit claim that "works of the law" in Galatians 3:10 refers not to the Mosaic law generally but only to a subset of it (i.e., ritual/ceremonial law, excluding moral law)? Is Machen's implication correct, or does such analysis originate in the early church?
Related: In the NPP, if Paul's “works of the law” are only circumcision and diet, how is Galatians 3:10 interpreted?