It was a repeating pattern for Israel. A judge would die, the people, now leaderless, would start to adopt the religious practices of the Canaanites around them, God would bring judgement, then they’d turn back:
Judges 4:1-3 After Ehud’s death, the Israelites again did evil in the Lord’s sight. So the Lord turned them over to King Jabin of Hazor, a Canaanite king. … , [his general] ruthlessly oppressed the Israelites for twenty years. Then the people of Israel cried out to the Lord for help.
It had already happened, starting shortly after the Israelites settled Canaan:
Judges 2:10-11 After that generation[of Israelites who occupied Canaan] died, another generation grew up who did not acknowledge the Lord or remember the mighty things he had done for Israel.The Israelites did evil in the Lord’s sight and served the images of Baal.
God’s response was firstly to pull out from protecting the Israelites from the nations around them, waiting for them to turn to Him for help. When they did, he gave them a leader, or judge, to rescue them. It established a repeating pattern:
Judges 2:18-19 Whenever the Lord raised up a judge over Israel, he was with that judge and rescued the people from their enemies throughout the judge’s lifetime. For the Lord took pity on his people, who were burdened by oppression and suffering. But when the judge died, the people returned to their corrupt ways, behaving worse than those who had lived before them. They went after other gods, serving and worshiping them. And they refused to give up their evil practices and stubborn ways.
And it happened again after another judge died,
Judges 6:1 The Israelites did evil in the Lord’s sight. So the Lord handed them over to the Midianites for seven years.
Judges 10:5-6 When Jair [a judge] died, he was buried in Kamon. Again the Israelites did evil in the Lord’s sight.
And so on.
The Israelites needed a strong person to lead them into staying faithful to God—something like a shepherd looking after the sheep. God wasn’t enough.
The people knew it when they later asked Samuel (the last judge) for a king:
1 Samuel 8:4-5 So all the elders of Israel gathered together and came to Samuel at Ramah. They said to him, ‘You are old, and your sons do not follow your ways; now appoint a king to lead us, such as all the other nations have.’
Jesus knew it too:
Mark 6:34 Jesus saw the huge crowd as he stepped from the boat, and he had compassion on them because they were like sheep without a shepherd. So he began teaching them many things.
But the idea was that God should be the shepherd, not a man or woman, as the King David wrote (or sang) in his famous psalm:
Psalm 23:1-4 The Lord is my shepherd, I lack nothing.
He makes me lie down in green pastures,
he leads me beside quiet waters, he refreshes my soul.
He guides me along the right paths for his name’s sake.
Even though I walk through the darkest valley,
I will fear no evil, for you are with me;
your rod and your staff, they comfort me.