During the commentary track on the Avengers: Infinity War Blu-ray release, Joe Russo shares a pretty harsh (if not playful) view of Spider-Man got himself vaporized. While we see Spider-Man first stowing aboard Ebony Maw's ship as it's leaving NYC, Russo states the following:
"Peter inserts his way into the story in a way that's going to have a very tragic ending for him. He should have stayed on the bus."
Clearly the comment isn't meant to be taken super-duper seriously, as Russo is simply providing some wishful thinking for how things could've gone differently for Peter. However, there is a certain amount truth behind the claim - even if it's said in jest.
At the end of Spider-Man: Homecoming, Peter made the decision to NOT accept Tony Stark's invitation to be an Avenger, preferring to stay close to the streets as the "Friendly Neighborhood Spider-Man." We never got to see if/how that outlook changed between Homecoming and the start of Infinity War, but based on how Homecoming left things, it would've been understandable for Peter to think twice before leaping from his school bus window and throwing himself into a big leagues fight, alongside the likes of Iron Man and Doctor Strange. After all, Spider-Man was pretty much out of his league for most of Infinity War, and his presence certainly made thing more tense for Iron Man.
On the other hand, whether the MCU movies choose to openly state it or not, Spider-Man's character is defined by the credo that 'With Great Power Comes Great Responsibility,' as well as a proud tradition of getting himself way in over his head. With so many characters to juggle, Avengers: Infinity War may not have had time to spell it out, but the filmmakers definitely seemed to understand the fundamentals of Spider-Man in making that story decision.
Avengers: Infinity War is now available on Digital platforms and lands on DVD and Blu-ray on August 14. It can be pre-ordered here. Ant-Man and the Wasp is now in theaters. Other upcoming Marvel Cinematic Universe movies include Captain Marvel on March 8, 2019, the fourth Avengers movie on May 3, 2019, Spider-Man: Far From Home on July 5, 2019, and Guardians of the Galaxy Vol. 3 in 2020.