From the first stages of civilization, including Israel’s time after Egypt, the first branch of government to be raised is that of the judge.
Moses served as a judge to settle disputes after crossing the Red Sea. He didn’t plan it; it just happened. His father in law suggested a court hierarchy to decrease Moses’s burden, which proved less exhausting.
Joshua also led Israel and it’s a good guess that the judicial hierarchy set up by Moses was also kept by Joshua. After Joshua died, God raised up “judges”. This would be very easy and could work without needing to instruct Israel because Israel had the judicial hierarchy explained in the Book of Exodus.
In a “Biblical theology” up into the Book of Judges, there is little to nothing describing the Messiah as a king or the promise of King David. The only government Israel knew was that of a judge. If those seven books of the Bible were your only Bible, studying about the judicial system would take up most of your time. After the judicial system of Moses in Exodus 18, much of the rest through Deuteronomy is the “Mosaic Law”, the rest interacts with Israel as they obey or disobey God. Joshua leads Israel into battle, according to justice, then we have Judges who settled disputes, guided morality, and led military conquests against invaders who took the domestic peace.
The next book, Ruth, begins the line leading to King David. Before Israel’s king was established, the role of the judge was well known. So, when Saul and David became kings, Israel knew that they would fulfill the very necessary role as Israel’s Judge. Samuel the prophet was the last judge and anointed both Saul and David.
As a king, Jesus will settle the disputes of the all nations across the world, just as Moses did. When people are foolish, Jesus will explain specifically how and why they were foolish, instruct them on how to get back on track, then lead them through whatever work or battles they must fight to push back the oppressors.
Jesus is also your personal judge who can guide your heart, call you to repent, and set you aright.
Exodus 18, Judges 2:16-23, Isaiah 2:4, Jeremiah 23:5-6, Micah 4:3-5, John 5:25-32, Revelation 19:15