Well, the Israelites wanted a king instead of a judge....that change was allowed
That is an interesting topic. Jews and careful readers for centuries have pondered the odd, conflicted position towards the appointment of Kings in the OT. It ought not surprise anyone that the reason is the exilic/postexilic redaction of the Deuteronomist history.
Compare the negative view 1 Sam 8 with the positive 9:1-10:16 then see the return to a negative version repeated starting at 10:17.
(Deut. 17:14a,b,15 has similarly been edited. The introjection in the center (b) changes the meaning negatively.
14“When you enter the land which the LORD your God is giving you, and you take possession of it and live in it,
and you say, ‘I will appoint a king over me like all the nations who are around me,’
15you shall in fact appoint a king over you whom the LORD your God chooses.
Think about the mind of a priestly/scribal caste of writers living in exile or just returned from there, the importance and value of a King no doubt was diminished if not distained. In the absence of a King the priestly leaders effectively govern the people, also during the early Persian period clambering for a King would have been (and was) disastrous. This is the same group that altered the texts regarding the covenant with David, making it conditional and a mere warning tale of history.
So rather than being God who changed his mind it was the writers. Of course that is always the case.