Avengers: Endgame marked the end of several stories of the Marvel Cinematic Universe, but among them was the story that started it all. Robert Downey Jr. played Tony Stark in Iron Man, the very first MCU film, and Endgame saw him sacrifice himself so that the universe might survive.
For the Russo Brothers, that end was something that was always going to happen. Joe Russo told our own Sean O' Connell on the Reelblend podcast that Tony Stark was always going to be looking toward to the potential dangers of humanity and would never be able to rest until he had done whatever he could to protect people, so the way to let him rest was to let him do that. According to Russo...
In a certain sense, Tony Stark was always meant to die. He’s a very complicated character who had a haunted existence. And I think as a futurist, he could always see that the end of humanity was on the horizon, and he could not rest, spiritually, until he defeated what was coming for humanity: Thanos.
Tony Stark certainly has one of the more interesting character arcs over the course of the MCU. In the first Iron Man he comes face to face with the damage that his products are actually capable of, and decides to do something about it. From that point forward, he becomes essentially obsessed with making up for the destruction he has caused.
In the end, as Joe Russo says, the story had to come down to Tony putting himself between the world and the threat that wanted to destroy it. Tony sacrificing himself to do that not only makes sense, it's the only thing that really does. If Tony survives then he'll probably just start looking for the next threat, and the man would never find peace.
It's an ending that many saw coming. Because we knew that Robert Downey Jr. was wrapping up his time in the MCU, it was clear that Iron Man would be written out of the universe in some way, and as sad as his death was, it's difficult to be too upset about it, because it feels like a satisfying conclusion to his story,
The death of Tony Stark isn't entirely the end of the story, however. The event itself is going to weigh heavily on Peter Parker, as we've seen in the newest trailer for Spider-Man: Far From Home. It's possible his death could have other repercussions as well as we get into the MCU's Phase 4 starting next year.