Ancient Judah had a problem idolizing the environment, and God condemned them for it because of the religious motivation behind the movement. In order to show the gravity of Judah's spiritual condition, Jeremiah compares it with that of exiled Israel, the faithless, backsliding northern kingdom.
Keep in mind that this is spiritual harlotry, as is seen in religion.
But later Israel committed spiritual adultery. Adultery is idolatry as Jeremiah 3 makes clear.
It is interesting. It says under every green tree and what are we running into is idolatry today. The environmental movement. So very little has changed in the mentality of people since ancient Israel was way she was and still is sadly.