One of the questions that fans frequently have regarding the Marvel Cinematic Universe films is just how often other parts of that universe influence any given project. Are writers and directors required to include particular elements in a movie in order to move the larger universe forward in the correct way? In at least one case, it seems there was a strong collaboration, as the team behind the most recent, and the upcoming Avengers films were involved in crafting the end credits sequence of Ant-Man and the Wasp. According to director Peyton Reed...
We all talked---it was Paul [Rudd], [Ant-Man and the Wasp writers] Chris McKenna and Eric Summers---and we sat down with the Russo Brothers and the screenwriters Marcus and McFeely about the timeline, but there was still a discussion with our movie in terms of who was going to get dusted, who was going to be on the parking deck.
While the general word from Marvel is that writers and directors have a remarkable amount of freedom to craft their own stories, Ant-Man and the Wasp found itself in a unique position, sandwiched as it was between the two big Avengers films. While the movie as a whole was a standalone story that didn't need to take the rest of the universe into account, the end credits sequence was a different story.
Decisions needed to be made regarding who survived "The Snap" and who did not as well as who we actually saw survive and not. These decisions could potentially play a part in what happens in Avengers: Endgame, and since all these movies were in production at around the same time, there needed to be a clear understanding from everybody involved.
Apparently, as Peyton Reed tells Collider, there was some discussion about potentially including more of Ant-Man and the Wasp's characters in the final credit sequence as well., though that was shot down. Interestingly, it appears that the basic structure of the scene itself was actually an idea form the Avengers: Infinity War screenwriters.
At one point we talked about, 'Is Bill Foster up there? Is Ava Starr up there? Do they all dust out?' but then it became a percentages thing. It's supposed to be 50%, so it can't be, 'Really? All of them went? That seems different than what I saw in Infinity War?' There were certain things that we knew. Marcus and McFeely pitched an idea for the scene and we all kind of built off that idea. It involved Scott and it involved Luis' van and a new Quantum Tunnel 2.0, but it was very collaborative thing.
It appears that whoever was on the roof of that garage was going to end up dead, and thus including too many other characters would have made it seem odd when only 50% of people were supposed to get dusted. Scott Lang was going to get stuck in the Quantum Realm one way or another.
On the plus side, since we actually lost 75% of the people in the post-credits scene, the math would indicate that more of our other favorite Ant-Man and the Wasp characters are probably ok, so things are looking good for Luis.