I think the thing with the MCU is that they realized awhile ago that having everything centered around these huge world ending events can be taken 100% seriously, but that comes with a ton of baggage. Like everyone in NYC would be emotionally destroyed after getting an alien invasion, a few city ending events, half the population disappearing and reappearing, in a decade and some change. The world would be fundamentally changed with everyone over 5 damaged beyond belief if they took the ramifications of stuff like the Snap, the existential crisis from seeing aliens and gods walking around, etc. so the other path is to play it more lightly a lot of the time.
Then there's also just the fact that we already live in a world where tragic events gets played with for levity all the time. Be it SNL, South Park, Stand Up, etc gallows humor is very popular and even within a few years of or even during, tragedies people will crack jokes.