Let's first understand the prohibitions, because all of them are important for Solomon:
Deuteronomy 17:16–20 (LEB):
Except, he may not make numerous for himself horses,
and he may not allow the people to to go to Egypt in order to increase horses, for
Yahweh has said to you that you may never return.
And he must not acquire many wives for himself,
so that his heart would turn aside;
and he must not accumulate silver and gold for himself excessively.
“And then when he is sitting on the throne of his kingdom, then he
shall write for himself a copy of this law on a scroll before the
Levitical priests. And it shall be with him, and he shall read it all
the days of his life, so that he may learn to revere Yahweh your God
by diligently observing all the word of this law and these rules, so
as not to exalt his heart above his countrymen and not to turn aside
from the commandment to the right or to the left, so that he may reign
long over his kingdom, he and his children in the midst of Israel.”
Now let's forget for a moment the issue of gold and look at the other prohibitions, all of which Solomon broke:
Too many horses
In 2 Chron 1.14
And Solomon gathered chariots and horsemen. And he had one thousand four hundred
chariots and twelve thousand horsemen, and he placed them in the chariot cities
and with the king in Jerusalem.
2 Chron 9.25:
And Solomon had four thousand stalls for horses and chariots, and
twelve thousand horsemen.
Bring horses from Egypt
2 Chron 1.17:
They went up and exported a chariot from Egypt for six hundred shekels
of silver and a horse for one hundred and fifty shekels. And these
were likewise exported to all the kings of the Hittites and the kings
of Aram.
The Hebrew in "went up and exported" is literally "brought up and brought out from Egypt chariots", suggesting this prohibition was also violated. See also 2 Chron 9.28:
And the horses were imported from Egypt and from all lands for
Solomon.
Imported meaning again "brought up from Egypt".
Too many wives
1 Kings 11.1-3
King Solomon loved many foreign women: the daughter of Pharaoh,
Moabite, Ammonite, Edomite, Sidonian, Hittite; from the nations which
Yahweh had said to the Israelites, “You shall not marry them, and they
shall not marry you. They will certainly turn your heart after their
gods.” But Solomon clung to them to love. He had seven hundred
princesses and three hundred concubines, and his wives turned his
heart.
Gold
Now let's get back to the gold, because this prohibition, unlike all the others, has several qualifiers:
The prohibition is on accumulating - literally multiplying, or chasing after - gold for himself, to excess. That's three important qualifiers.
- If you are given gold, it's not a violation.
- If you chase after the gold you need, it's not a violation.
- If you chase after more gold than you need but not for yourself, it's still not a violation.
Why all these qualifiers? Because kings need to be wealthy. At that time, the king's personal treasury was also the government treasury, so a poor king was a poor nation. Thus God, in making Solomon wealthy, was also making Judah wealthy, wealthy enough to build the temple.
But chasing after excess gold will result in levying harsh taxes, or stealing, or some other kind of immorality, and doing this for yourself risks the king becoming haughty. So the prohibition wasn't against the king being rich, but against this chasing after excess wealth for personal reasons.
Now given the situation that God wanted a gold plated temple, if he didn't give Solomon lots of gold, Solomon would need to start chasing after it, which would already send him down the road of violation. Thus God, rather than changing his mind about the prohibition, was trying to keep Solomon from breaking it by making Solomon wealthy as a result of giving him the money.
How? Well, David died and left a lot of gold for the temple, but Solomon needed more. Then Kings and Queens would visit Solomon and give him gold on account of his wisdom -- e.g. he would answer their most difficult questions and solve their problems.
King Solomon was greater than all the kings of the earth with respect
to wealth and wisdom. All of the earth was seeking the presence of
Solomon, to hear his wisdom which God had put in his heart. They were
each bringing his gift; objects of silver and objects of gold,
clothing, weapons, spices, horses, and mules. This used to happen year
after year. 1 Kings 10.23-25
So when God told Solomon that because he asked for wisdom instead of wealth, he would make him wise and wealthy, there was a casual connection between the two.
And it happened that the weight of the gold that came to Solomon in
one year was six hundred and sixty-six talents of gold, besides that
which traders and merchants brought, and all the kings of Arabia and
the governors of the land brought gold and silver to Solomon. 2 Chron 9.13-14
At this point, I don't see any violation, but the next source of wealth gets tricky:
1 Kings 9.15-19
This is the account of the forced labor that King Solomon conscripted
to build the house of Yahweh and his house, the Millo, the walls of
Jerusalem, Hazor, Megiddo, and Gezer.Pharaoh, the king of Egypt, had gone up and
captured Gezer and burnt it with fire. He had also killed the
Canaanites who were living in the city and had given it as a dowry to
his daughter, the wife of Solomon. Solomon rebuilt Gezer and Lower
Beth-Horon, as well as Baalath and Tamar in the wilderness in the
land; and he also built all of the storage cities which were
Solomon’s, the cities for the chariots, the cities for the cavalry,
and all of Solomon’s desire that he wanted to build in Jerusalem and
in Lebanon and in all the land of his dominion.
Here, unlike the source of wealth that required no chasing, this source of wealth is a burden on the people. Even for building God's house, this is a bad omen, because the tabernacle was adorned with gold on a voluntary basis, and David collected donations for the temple also on a voluntary basis. Now, Solomon is marrying the daughter of Pharoah so he can receive the land that Pharoah conquered as a dowry and also use the population of that land as forced labor for his building projects - including the temple! This directly leads to idolatry as he builds altars in high places for the foreign people he conquered and whose most beautiful women he took as concubines for himself. Alarm bells should be going off. Compare with David, who when a Jebusite offered to give him the ground the temple would be built on insisted on paying for it (2 Sam 24.24), and here his son marries the daughter of pharoah so he can conscript foreign slaves to build God's house.
Did Solomon do this because the gold God gave him wasn't enough? No, he spent 7 years building the temple and then 13 years building a much bigger palace for himself and then turned to lavish building projects to satisfy "all of Solomon’s desire that he wanted to build in Jerusalem and in Lebanon and in all the land of his dominion."
Conclusion
Thus I believe Solomon violated the gold accumulation rule despite God making him so wealthy, and not because of it -- and also despite being the wisest king.
Even though Solomon himself didn't become haughty, his son did, and the empire was split in two because of the high burdens and arrogance of Rehoboam, who refused to reduce the taxes after Solomon's death.
So I would say that God didn't change his mind. When kings try to multiply their gold excessively in order to benefit themselves, then this is a violation and leads to disaster:
1 King 11:31-33
Then he said to Jeroboam, “Take for yourself ten pieces, for thus says
Yahweh, the God of Israel: ‘Behold, I am about to tear the kingdom
from the hand of Solomon, and I will give to you ten tribes, but one
tribe shall be for him, for the sake of my servant David and for the
sake of Jerusalem, the city which I have chosen from all the tribes of
Israel; because he has forsaken me, and they bowed down to Ashtoreth,
the god of the Sidonians, to Chemosh, the god of Moab, and to Milcom,
the god of the Ammonites. They did not walk in my ways to do right in
my eyes, my ordinances, or my judgments, as did David his father.