An urgent prophetic revelation immediately halts the plans to build the Temple. Right after the prophet and the king discuss the project, the word of God arrives in the dark of night. The pressing need to deliver this message without delay stems from the specific character of King David [רש״י].
David is known as a man deeply prone to making vows. Because of this, God hurries to intervene before the king can formally swear an oath to build the house. Additionally, David possesses immense energy and a strong drive for swift action. If left unchecked, his enthusiasm might lead him to rush ahead and hire workers to begin the actual construction before the prophecy reaches him. By sending the message immediately, God ensures that the king's eagerness does not outpace His plan.