Are Chazal always right?
It is true that Chazal say that a temple could not be built until Israel went to war with Amalek. Amalek, although a war-like nation, should not be attacked until a peace offer has been made, or that fighting should cease from the Jews if certain requirements were met. See Mishneh Torah, Concerning Kings and Wars 5:1 and 6:1, 4. It suffices to say that Amalek came from being a nation to a philosophical concept of evil itself, for example, the nazis. That aside, the Babylonian Talmud, Sanhedrin 96b, says that not all of Amalek (nation) should be killed, for many of them later became proselytes to Judaism, becoming Torah scholars in B’nei Berak. Besides, Chazal's statement makes it seem as though G-d needs a bloody war for the temple to be built.
So what is the real reason why David did not build a temple? or, for that reason, the forefathers.
The real reason for the absence of the Temple
Moses, the founder of Rabbinic Judaism, was ordered to build a simple portable tent-like structure, called the Tabernacle. The mobile tent followed the Israelites wherever they went. It is not as far as a stretch for the purpose of this tent-like temple. For one, it provided people a place to worship or draw near to G-d in times of exile or wonderings. It also was the only building material they had. They certainly could have built a temple if they wanted. Indeed they built the grand temples for Pharaoh. The reason they resorted to a tent-like structure was that they were always on the move, like nomads, traveling to the promised land, the land of their fathers, the land of Israel. Abraham, Isaac, and Jacob, all dwelled in tents. It might have been a culture thing, too.
Other reasons for the Sanctuary
The biblical sanctuary tent was partially constructed in the manner that it was in order to show that it was not a permanent dwelling spot for a noncorporeal G-d. The “Meeting House,” was a place where people went to metaphorically meet with G-d. When David took Jerusalem, he thought it time to construct a more permanent residence of worship, not only the political capital but a spiritual center. However, the book of Samuel in II Samuel 7:6 reports how prophet Nathan told David that now was not the time nor the place. This was due to David's sins, G-d has become angry with him.
The biblical book of I Kings 5:3 avoids the theological issue altogether. In it, Solomon informs Hiram the king of Tyre the reasons for his father's neglect for the construction of a temple. Saying,
“You know that David my father could not build a house for the name of
the L-rd his G-d because of the warfare with his enemies who
surrounded him, until the L-rd put them under the soles of his feet.”
In other words, David was preoccupied with war. Later commentaries, including the Talmud, would portray David as piously playing the harp and his court studying the scriptures. This is hardly the case. The royal court spared no time for study except for Shabbat and other rear occasions. The political life of a king wasn't all fun and games. It consisted of much work and immense responsibility of running the kingdom. As all national leaders, they were often preoccupied with national affairs and had little time, if any, to devote themselves to the life of a pious rabbi. Even rabbis worked as a second profession. Rambam put many emphases on an occupation besides a rabbinical degree.
That aside, I Chronicles 22:8 reports G-d saying:
“You have shed much blood and
have waged great wars; you shall not build a house to My name because
you have shed so much blood before Me upon the earth.”
This supports the idea that David was preoccupied with sex, war, and national security.
What did Maimonides say
Interestingly, the Guide of the Perplexed 3:32 makes a radical statement, but one that makes sense. It states that G-d does not want or need a temple. Indeed, G-d is neither in want or need of anything. The temple and sacrifices were necessary as a concession to the primitive nature of human beings. People, Maimonides stressed, should seek G-d by studying all that there is to know about Him, which is the study of science and philosophy, metaphysics, and the laws of nature, not pious study, secluded, contributing nothing to society. One can see this as a prime example among the Patriarchs. They were preoccupied with philosophy and the new idea that G-d is one: the monotheistic revolution. This may be the chief reason why the patriarchs saw no need for a temple or tent. Abraham, the founder of Judaism, discovered G-d by studying the heavens, the laws of nature. Only then did G-d come to him. Abraham saw no need for a temple or the mitzvahs. However, the Rambam goes on to explain this as the chief reason why the Israelites forgot about G-d while in slavery in Egypt. People cannot just rely on philosophy. Thus, G-d made another concession by giving us a gift, the Torah and the mitzvot.
Many of the patriarchs never saw a need to build a house of worship. When they did, they constructed one similar to their dwellings, a tent. Later, David, ever wanting for glory, decided it was time to construct a temple where the new capital of Israel will be built. When he acted improperly, that right is taken away and is inherited by Solomon. Yet, G-d never desired a temple. It is a concession to human needs. People need to feel that they can draw close to G-d. As a result, G-d allowed the sacrifices but, He restricted them to certain animals that were kosher.
 The Torah is certainly holy. It follows that the Torah should not be abandoned in the messianic age like the sacrifices or, as some claim, the mitzvolt. I found this idea that the Torah is a concession in Menachem Kellner's Science in the Bet Midrash: Studies in Maimonides, where he states that, "Maimonides' notorious claim to the effect that the Torah as we have it is a concession to the primitive character of the Israelites leaving Egypt." He goes on in the footnote to write,
"To traditional Jewish ears this sounds shocking. Indeed, Maimonides himself wrote about it: "I know that on thinking about this at first your soul will necessarily have a feeling of repugnance toward this notion and will feel aggrieved because of it" (Guide, III.32, p. 527). But the fact of the matter is that in structural terms, Maimonides is making a claim very similar to that made by Kabbalists; only when they make it, it sounds very religious. When Maimonides makes it, it sounds shocking. There is an important strand in Kabbalah, expressed openly by Nahmanides, amongst others, that the Torah as we have it exists in its corporeal form only because of the sin of Adam and Eve, and will cease to exist in the form in which we know it in the messianic era. I have a hard time understanding how that differs in structure from Maimonides' position (I realize that the music is very different.)"