The Midrash Tanchuma (Va’eschanan 4) relates that Moshe Rabbeinu said to Hashem, “Ribon HaOlamim, You referred to me as Moshe, My servant (Bamidbar 12:7). I truly am Your servant. You also wrote in Your Torah (Shemos 21:5) that the eved Ivri, Hebrew bondsman who refuses to leave servitude after the prescribed six years goes through a process and avado l’olam, he remains in servitude until Yovel. Thus, Hashem, I ask to be allowed to remain in my position as an eved and continue serving You.” Hashem replied, “Rav lach, it is too much for you. It has already been decreed that you are to die.” The Rambam (Hilchos Yesodei HaTorah 10:4) writes that when a Navi, prophet, prophesizes a punishment (i.e. an event such as death, hunger or war), even if it does not come to pass, it is no indication that the prophet is not truthful. Hashem is merciful and the person (people) might have repented, so Hashem may have absolved him (them). If the Navi promised that something good would occur, however, and it does not materialize, he is deemed to be a Navi sheker, false prophet. Anything good that emanates from Hashem, any decree for good which Hashem decrees (which is what the Navi claimed would happen) must occur. Otherwise, the Navi is a false prophet.
The Brisker Rav, zl, applies the Rambam to explain Moshe’s appeal to Hashem to allow him to live and lead the nation into Eretz Yisrael. The Almighty had the power to change His decree from bad/destruction to good, thus permitting him to enter the Land. Hashem responded that, in theory, Moshe was correct. He had told him, however, to refrain from speaking to/leading the nation, because Yehoshua’s “turn” had come. Part of the gezeirah, decree against Moshe, was that he would no longer lead the nation, and that the reins of leadership would hence be transferred over to Yehoshua, his trusted student. The gezeirah thus includes “good” (Yehoshua’s leadership). This cannot be rescinded. The “good” must materialize, even at the expense of Moshe’s continued life.
We see from here that it is not always as we see it through our eyes of flesh and blood. Indeed, Hashem renders all decisions precisely because His sweeping vision sees everything at once. Avraham Avinu died five years earlier than Yitzchak Avinu, so that he would not be witness to his grandson, Eisav, going off the derech, leaving the path, and becoming the paradigm of evil that he become. Now, let us imagine that Yitzchak and Rivkah Imeinu, who waited twenty years for their twins, would have been blessed with progeny right after the wedding. This is why I say, Baruch Hashem, the Almighty makes the decisions. What we do not know is for our own good.