In the Old Testament, was the rule of kings in Israel God's plan all along?

In the Old Testament, was the rule of kings in Israel God's plan all along?