There’s actually two kinds of legalism, which I’ll call theology legalism and moral legalism.
* Theological legalism says that we are justified by our works. Jesus teaches obedience, and so do the various epistles. So requiring obedience is not legalism. It is requiring obedience independent of the faith on which it is based that is legalism, or saying that we can be justified by having our works be sufficiently perfect.
* Moral legalism, however, can exist even in people who understand perfectly that justification is by faith. It’s defining obedience by rules that can’t be supported by Scripture. The discussion over using wine is an example. People who advocate prohibition are not necessarily theological legalists.
It's worth distinguishing these, to avoid making accusations against people that are false.
From Paul's teaching in Galations, I gather a perspective that includes both of your examples.
O foolish Galatians, who hath bewitched you, that ye should not obey the truth, before whose eyes Jesus Christ hath been evidently set forth, crucified among you?
[2] This only would I learn of you, Received ye the Spirit by the works of the law, or by the hearing of faith?
[3] Are ye so foolish? having begun in the Spirit, are ye now made perfect by the flesh?
[4] Have ye suffered so many things in vain? if it be yet in vain.
[5] He therefore that ministereth to you the Spirit, and worketh miracles among you, doeth he it by the works of the law, or by the hearing of faith?
KJB.
Jews were influencing the Church to abide in both,a theological belief that Christ made the sacarfice that paid for the sin.
The Jews as well we're teaching that Christians must still abide in the Law of Moses to earn the gift.
Galatians is considered the [freedom epistle] due to Paul's passionate teaching on the Great gift of Salvation.
Being a spiritual gift by Grace through faith,no man could ever be sanctified by the works of the Law again.
This is still going on today, men form opinions on their hearts desire then attempt to justify themselves by quoting from Leviticus etc.
Most of the time their teaching is still flawed, because their references are even out of the context of the Law of Moses.