In a different context, the Rambam has a famous theory regarding sacrifices. In the words of Reuven Chaim Klein
Maimonides explains that the Torah’s main objective is to eradicate the viewpoint of paganism. Thus, to truly understand the Torah’s original intent, one must be familiar with the philosophies and practices of ancient idolaters [...]
Taking this idea a step further, Maimonides seemingly assumes that ritual sacrifices are a sub-optimal form of worship, leading him to making the bold statement that the Torah instituted its system of ritual sacrifices to facilitate the rejection of idolatrous practices. > He explains that human nature is that whatever people have accustomed themselves to doing becomes so ingrained in their nature that it cannot be easily uprooted. Man cannot successfully transition from one extreme to the other without some time to acclimate.
See More Nevuchim 3:32 for the original, here are relevant quotes
It is, namely, impossible to go suddenly from one extreme to the other: it is therefore according to the nature of man impossible for him suddenly to discontinue everything to which he has been accustomed. [...] But the custom which was in those days general among all men, and the general mode of worship in which the Israelites were brought up, consisted in sacrificing animals in those temples which contained certain images, to bow down to those images, and to burn incense before them; religious and ascetic persons were in those days the persons that were devoted to the service in the temples erected to the stars, as has been explained by us. It was in accordance with the wisdom and plan of God, as displayed in the whole Creation, that He did not command us to give up and to discontinue all these manners of service; for to obey such a commandment it would have been contrary to the nature of man, who generally cleaves to that to which he is used [...]
For this reason God allowed these kinds of service to continue; He transferred to His service that which had formerly served as a worship of created beings, and of things imaginary and unreal, and commanded us to serve Him in the same manner [...]
By this Divine plan it was effected that the traces of idolatry were blotted out, and the truly great principle of our faith, the Existence and Unity of God, was firmly established; this result was thus obtained without deterring or confusing the minds of the people by the abolition of the service to which they were accustomed and which alone was familiar to them.