Grace has always been present. Grace for salvation began with Adam and Eve.
The initial covenant for salvation was one of works. There was a singular prohibition and had that commandment been kept, it would have led to eternal life at some point. It wasn't, thus, grace became necessary.
The particular verses you ask about reflected the estate of Israel in the time of the Apostle. Some were saved by grace, but most had not. Hence, Israel failed to obtain what it desired: life through the law.
Have you ever read the law of the lepers in Moses law this is how the works of the law speak of lepers it’s one of the longest chapters in the law so I’ll just show a few verses tommake the point. this is how the worlds of the law compare to the Word of faith
“And the LORD spake unto Moses, saying, This shall be the law of the leper in the day of his cleansing: He shall be brought unto the priest: and the priest shall go forth out of the camp; and the priest shall look, and, behold, if the plague of leprosy be healed in the leper; then shall the priest command to take for him that is to be cleansed two birds alive and clean, and cedar wood, and scarlet, and hyssop: and the priest shall command that one of the birds be killed in an earthen vessel over running water: as for the living bird, he shall take it, and the cedar wood, and the scarlet, and the hyssop, and shall dip them and the living bird in the blood of the bird that was killed over the running water: and he shall sprinkle upon him that is to be cleansed from the leprosy seven times, and shall pronounce him clean, and shall let the living bird loose into the open field. And he that is to be cleansed shall wash his clothes, and shave off all his hair, and wash himself in water, that he may be clean: and after that he shall come into the camp, and shall tarry abroad out of his tent seven days. But it shall be on the seventh day, that he shall shave all his hair off his head and his beard and his eyebrows, even all his hair he shall shave off: and he shall wash his clothes, also he shall wash his flesh in water, and he shall be clean. And on the eighth day he shall take two he lambs without blemish, and one ewe lamb of the first year without blemish, and three tenth deals of fine flour for a meat offering, mingled with oil, and one log of oil. And if he be poor, and cannot get so much; then he shall take one lamb for a trespass offering to be waved, to make an atonement for him, and one tenth deal of fine flour mingled with oil for a meat offering, and a log of oil; and two turtledoves, or two young pigeons, such as he is able to get; and the one shall be a sin offering, and the other a burnt offering. And he shall bring them on the eighth day for his cleansing unto the priest, unto the door of the tabernacle of the congregation, before the LORD. to teach when it is unclean, and when it is clean: this is the law of leprosy.”
Leviticus 14:1-10, 21-23, 57 KJV
again this is just a short sample of what had to be tediously done and it might not work according to the law but there’s like fifty things they had to do ritually to have a chance of cleansing lepracy
now the difference in the gospel and faith and how a leper is cleansed
“And, behold, there came a leper and worshipped him, saying,
Lord, if thou wilt, thou canst make me clean.
And Jesus put forth his hand, and touched him,
saying, I will; be thou clean. And immediately his leprosy was cleansed.”
Matthew 8:2-3 KJV
The one in the gospel wasn’t cleansed by the works of the law but by the faith of Jesus Christ hearing and knowing his word that said “ I know you can do this if you will lord Jesus “ and the answer that said “ I’m willing be ye clean “
There was no hundred ordinances and ritualistic works required he wasn’t cleansed by works but Jesus had mercy on him and he had faith in Jesus
“Not by works “ doesn’t mean our deeds don’t apply but it’s just saying the many works of the law aren’t what saves anyone but instead it’s Gods grace and thier faith in him meaning they hear and believe his word knowing who’s word it is