Wa `alaykum as-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear brother, thank you for your question that shows your interest to be more knowledgeable about Islam.
As for your query, the verse you mentioned does not contain any extravagance or worship of statues. Moreover, there are many prohibited acts in Islam that were permissible at the time of other Prophets.
In his response to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states,
You are referring to the following verse, “They made for him whatever he wished of sanctuaries, and statues, and basins as [large as] great watering – troughs, and cauldrons firmly anchored. [And We said:] “Labor, O David’s people, in gratitude [towards Me] and [remember that] few are the truly grateful [even] among My servants!” (Saba’ 34:13)
I do not see any reference here to palaces, although there is no prohibition of building palaces as long as there is no extravagance involved.
Making statues is forbidden in Islam because of its association with shirk; and it was not forbidden in the Law of Moses (peace be upon him).
You are right in stating that Islam is a religion that stresses moderation. However, we are not in a position to make judgments over the actions of the Prophets of the bygone past in so far as they have done certain things which were allowed for them. Such laws are not applicable to Muslims if they were abrogated.
Allah Almighty knows best.