And note that such a legal system existed in Jericho for nearly 9000 years, and part of that story is recorded in books of the Old Testament, most especially Samuel and Judges.
Samuel 8, specifically, warns against substituting the Law of God with the Will of the Monarch, and how it leads to corruption and enslavement.
For a few hundred years the Icelanders also had a system like this where if you were unhappy with your local chief you could pay your dues to another chiefe from elsewhere to be your advocate, and the result was that bad chiefs went broke and good chiefs got rich and there was relative peace from centuries of blood feuds until the catholics came in to fill the role of organised crime cartel.