You might argue (see the comments to that post) that the question should not get off the ground. Miriam was by this point well advanced in years. Do we need a justification for her death? No one lives forever. Maybe Miriam deserved to get to Eretz Yisrael, but nebech, she just passed away before getting there. I thought a reply to that point deserved it's own post.
The Sefas Emes (5639, see here) says a yesod in last week’s parsha: Death = your task in the world is complete. Every person has a tikun to accomplish, and once the tikun is accomplished, you move on. It’s like a video game – when all the monsters are killed in one level, you move on to the next.
Aharon is told he must die because he sinned and could not enter Eretz Yisrael. So what, asks the Sefas Emes? Bnei Yisrael were not on the border of Eretz Yisrael yet -– maybe Aharon had a few more days or weeks left in him? The answer is that Aharon already had accomplished everything he could in this world short of being mekayeim mitzvos of Eretz Yisrael. If those mitzvos had been part of his mission – which they would have been had he not sinned – he would have continued to live. Since those mitzvos were no longer on the agenda, his mission was up, and m’meila his time was up.
What we can accomplish in this world is not dependent upon how much time we are allotted to be here – aderaba, how much time we are allotted to be here depends on what we can accomplish. It makes no sense to say Miriam really deserved to get to Eretz Yisrael but nebech, her time was up. If Miriam had the zechuyos that would allow her to be in Eretz Yisrael, her mission was not over yet, and m'meila her time in this world would not have ended yet.
If you saw the update to the previous post, you saw the link to the Midrash’s answers to the question of why Miriam died. One answer is that her well had to vanish, which could not happen so long as she was alive. I thought this put the cart before the horse – the well vanished, I thought, because Miriam died; not that Miriam died so that the well could vanish. My wife thought the Midrash means to tell us that the miraculous hanhaga of the midbar had to come to an end before Bnei Yisrael entered Eretz Yisrael. The miracle of getting water from Miriam’s well could not continue; in Eretz Yisrael, water would have to be drawn from rivers, means of irrigation would have to be developed,etc. Therefore, Miriam had to die so that Bnei Yisrael could come down to earth, so to speak, and continue their mission in Eretz Yisrael, albeit without her.