In parshat Devarim, Moshe Rabbeinu discusses the sin of the spies at length (דברים א׃יט־ב׃א). He mentions the decree forbidding that generation from entering the land, saying "If even a man of these people, this evil generation, shall see the good land that I swore to give to your forefathers..." (דברים א׃לה). Then, strangely, he mentions that he too was forbidden to answer the land, saying "With me, as well, Hashem became angry because of you, waying: You, too, shall not come there" (דברים א׃לז). What is this explanation doing there? How was Moshe Rabbeinu's prohibition related to that of the rest of the generation of the midbar? After all, his sin was 40 years after theirs, when he hit the rock to get water for the people, instead of speaking to it (במדבר כ׃יב).
The Ohr HaChaim explains (דברים א׃לז) this. The paseuk says in connection with the sin of the spies, "and the nation cried that night" (במדבר יד׃א). The Gemara (תענית כט ע״א) explains that this night was Tisha B'av, and because the nation cried on that night for no reason, Hashem decreed that they would cry on that night throughout the generations, because the Bet HaMikdash would be destroyed then. Another Gemara (סוטה ט ע״א), explains that if Moshe Rabbeinu had entered Eretz Yisrael, and built the Bet HaMikdash, then it could not have been destroyed. A midrash (מדרש תהלים עט) further explains that the result would have been the complete destruction of Am Yisrael when they sinned, and not the (relatively) minor destruction of the Bet HaMikdash. Thus, Hashem decreed Moshe Rabbenu's death at that time, so that he could not build the Bet HaMikdash.
So what about the Moshe Rabbenu's sin of hitting the rock instead of speaking to it? The Ohr HaChaim hints that if Moshe Rabbeinu had sanctified the name of Hashem at that time, then Am Yisrael would have returned to the level of purity that they had before the sin of the spies, and Hashem would have reversed the decree of Moshe Rabbenu's death.
It seems to me that the peshat behind this is as follows: the sin of the spies was in believing (and convincing Am Yisrael) that they would need to work hard to conquer the land on their own, and that the nations then in the land were too powerful for them to conquer. Moshe Rabbenu was asked to speak to the rock and a miracle would be performed. Had he done that, Am Yisrael would have understood that Hashem would do a lot for them effortlessly, particularly the conquest of Eretz Yisrael, and this would have reversed the sin of the spies.
In the end, it took Am Yisrael 7 years to conquer the land sufficiently that they could settle it, and they never fully uprooted the original inhabitants. There are numerous warnings of the corrupting effect of letting the original inhabitants stay in the land (דברים ז׃א־ה), but since Am Yisrael never fully kicked them out, they were susceptible to the sins that eventually caused the destruction of the Bet HaMikdash. It was possible to have an effortless, complete conquest of Eretz Yisrael, as we see in Sefer Bemidbar that Israel conquered Sihon, Og, and Midian in a matter of days, an area totaling the size of Eretz Yisrael. Why couldn't they do that in Eretz Yisrael? Because Hashem made it hard in accordance with their expectations. Had Hashem granted us this kind of conquest of Eretz Yisrael, none of the inhabitants would have remained to be a thorn in our sides to cause the sins that eventually led to the destruction of the Bet HaMikdash.
May we merit to see the Bet HaMikdash rebuilt, speedily in our days. (Preferably before Sunday, but if not have a good fast.)