Marvel Studios and the makers of Avengers: Endgame were so tight and kept the spoiler from not breaking out to an extent where they only gave three major plot points to the writer of Spider-Man: Far From Home writers Erik Sommers and Chris McKenna. The writers had to write the movie’s story which takes place after Avengers: Endgame not knowing what exactly happens in Endgame.
This is what McKenna told to the New York Times,
We were like, ‘Wait, who goes away? And how do they come back?’ We didn’t actually see Endgame until the premiere — maybe if we’d known more in advance, we would have made a joke about Valkyrie riding a Pegasus, because you definitely want to reference that.
Surly who wouldn’t speak about riding a flying horse. Peter must have enjoyed it. Sommers added,
You’re given everything on a need-to-know basis.
Which referred to the deaths of Iron man(Robert Downey, Jr.) and Black Widow(Scarlett Johansson), the five-year time jump and half the universe coming back after the second snap.
The two major things we knew were the five-year gap and the ramifications it would have for the people who did and didn’t get blipped away, and, obviously, the Tony of it all.
Tony’s death was also revealed to the editors of Spider-Man: Far From Home, Dan Lebental and Leigh Folsom Boyd, who watched Avengers: Endgame in the final post-production stages of Far From Home. This urged the editors to make a few changes in the Spider-Man sequel. This is what Lebental told to The Hollywood Reporter,
They did show us Endgame early, but way into the process on this film, at a certain point we had our conceptions of what Endgame was but then I saw it. OK. We need to make a few adjustments.
The other editor Leigh Folsom Boyd was convinced that half of the universe is permanently gone and are never coming back. But the truth being, the ones that died permanently are Iron Man and Black Widow. Lebental added,
We did have to adjust it to feel right, and then it became making the father-son connection between Tony Stark and Peter
In every Spider-Man story, Peter(Tom Holland) always loses someone close to time and now it’s his mentor and inspiration, Tony Stark. The makers of Spider-Man: Far From Home had to make necessary changes that make Tony’s death justifiable and Far From Home stand an epilogue to the Infinity Saga.