Here is one of the most important sections in the Old Testament concerning Israel and the crept in unawares.
Judg 2:1-4
1 And an angel of the LORD came up from Gilgal to Bochim, and said, I made you to go up out of Egypt, and have brought you unto the land which I sware unto your fathers; and I said, I will never break My covenant with you.
2 And ye shall make no league with the inhabitants of this land; ye shall throw down their altars: but ye have not obeyed My voice: why have ye done this?
3 Wherefore I also said, I will not drive them out from before you; but they shall be as thorns in your sides, and their gods shall be a snare unto you.
4 And it came to pass, when the angel of the LORD spake these words unto all the children of Israel, that the people lifted up their voice, and wept.
(KJV)
God gave the children of Israel that specific rebuke because they failed to complete His ordained judgment upon the nations of Canaan that were guilty of all sorts of abominations against Him, and they had failed to repent. Because of that, God said He would not drive those peoples of Canaan away from the children of Israel, but their ways and gods would become snares upon Israel.
As a result of that, look what Israel soon fell to...
Judg 2:11-17
11 And the children of Israel did evil in the sight of the LORD, and served Baalim:
12 And they forsook the LORD God of their fathers, Which brought them out of the land of Egypt, and followed other gods, of the gods of the people that were round about them, and bowed themselves unto them, and provoked the LORD to anger.
13 And they forsook the LORD, and served Baal and Ashtaroth.
14 And the anger of the LORD was hot against Israel, and He delivered them into the hands of spoilers that spoiled them, and He sold them into the hands of their enemies round about, so that they could not any longer stand before their enemies.
15 Whithersoever they went out, the hand of the LORD was against them for evil, as the LORD had said, and as the LORD had sworn unto them: and they were greatly distressed.
16 Nevertheless the LORD raised up judges, which delivered them out of the hand of those that spoiled them.
17 And yet they would not hearken unto their judges, but they went a whoring after other gods, and bowed themselves unto them: they turned quickly out of the way which their fathers walked in, obeying the commandments of the LORD; but they did not so.
(KJV)
Judg 2:20-23
20 And the anger of the LORD was hot against Israel; and He said, Because that this people hath transgressed My covenant which I commanded their fathers, and have not hearkened unto My voice;
21 I also will not henceforth drive out any from before them of the nations which Joshua left when he died:
22 That through them I may prove Israel, whether they will keep the way of the LORD to walk therein, as their fathers did keep it, or not.
23 Therefore the LORD left those nations, without driving them out hastily; neither delivered He them into the hand of Joshua.
(KJV)
God ordained those left of the nations of Canaan to serve as a test upon His people Israel. That's how it is still, to this day.
Judg 3:1-7
1 Now these are the nations which the LORD left, to prove Israel by them, even as many of Israel as had not known all the wars of Canaan;
2 Only that the generations of the children of Israel might know, to teach them war, at the least such as before knew nothing thereof;
3 Namely, five lords of the Philistines, and all the Canaanites, and the Sidonians, and the Hivites that dwelt in mount Lebanon, from mount Baalhermon unto the entering in of Hamath.
4 And they were to prove Israel by them, to know whether they would hearken unto the commandments of the LORD, which He commanded their fathers by the hand of Moses.
5 And the children of Israel dwelt among the Canaanites, Hittites, and Amorites, and Perizzites, and Hivites, and Jebusites:
6 And they took their daughters to be their wives, and gave their daughters to their sons, and served their gods.
7 And the children of Israel did evil in the sight of the LORD, and forgat the LORD their God, and served Baalim and the groves.
(KJV)
In 1 Kings 9 during Solomon's days, those Canaanite peoples were still living among Israel. They later became known as Nethinims, working their way up into the Temple doing menial chores as Temple servants. Then they became priests per Ezra 2 going captive to Babylon with the house of Judah, and returning with the small remnant of Judah back to Jerusalem afterwards. That's how God's Word became corrupted by the time of Christ's first coming. Per the Jewish historian Josephus, even the high priests by then were not of the children of Israel.
Like God has said, He would leave that remnant of the nations of Canaan among Israel, to prove them, to see if they would obey Him or not.
So, what if Israel had obeyed God's command to destroy all the nations of the land of Canaan? Most likely, they would not have fallen into Baal worship over their history, the priesthood of Israel would not have become corrupted, and the false ones of the scribes and Pharisees would not have sought to kill our Lord Jesus. But because this was ordained to happen, it set the stage for our Lord Jesus' first coming to die on the cross. It has also set the stage for the events of the last days, with their beast king they worship coming to exalt himself above God and His Christ.
That's why we should never forget that there are literally children here on earth that worship Lucifer as their god, and it is the very SAME working that those nations of Canaan did of old. We are STILL in that same battle today upon this earth. If the workers of iniquity had never existed, this battle would not be possible, and Israel would not have been led astray.
This is why it's a gross error to think those fallen away of Israel are in the same boat as the pagan Canaanites that worship the devil. The differrence is that many of Israel, out of ignorance, have been led astray by the Canaanites that dwell among them. That's exactly how things are today, even as our Lord showed it will be until He returns...
Zech 14:21
21 Yea, every pot in Jerusalem and in Judah shall be holiness unto the LORD of hosts: and all they that sacrifice shall come and take of them, and seethe therein: and in that day there shall be no more the Canaanite in the house of the LORD of hosts.
(KJV)