Two decades into the 21st century, it's safe to say the superhero movie has fully integrated itself into pop culture. The X-Men and Sam Raimi Spider-Man movies built on the bedrock foundation laid by the Tim Burton Batman and Richard Donner Superman films and themselves paid the way for the genre-defining Marvel Cinematic Universe. Which in turn inspired the DC Extended Universe, accompanied by its own set of ups and downs. At this point, the only thing more certain than a superhero sequel film is death.
It's at the crossroad between the two where things start to take a negative turn. See, comics kill off characters all the time. If characters get big enough, their deaths can be promoted as big event comics that can sell for higher or to a wider audience. This happens so much that event deaths and subsequent resurrections are a trope of the medium.
But in films things can be a little more difficult. Given the extended periods between films, it's harder to nail the exact right moment to kill off a popular character. Failing to do so can ruin an entire movie, just by killing the wrong hero at the wrong time.