Congratulation, you have just realised your deity is a poor general and an even worst sovereign and leader. He failed to secure his first victories before attempting new ones leading to the defeat of his forces. That's a rookie's mistake. Your deity basically spent centuries back tracking...
When you read the whole chapter you will see that there were many of the Canaanites that were not driven out. (Judges 1:21-36) All of which was disobedience to the LORD. The Israelites defeats were products of their moving away from God. (Judges 2:1-3). See (Joshua7:1-5)
Thus you have...