Captain Marvel missed out on most of Avengers: Endgame. Her return in the frenetic chaos of the climactic battle though, soaring from the heavens in the orange fireball of her Binary Mode and obliterating Thanos’ warship without even slowing down, was a suitably epic moment. However, it was originally planned somewhat differently.
Carol’s removal from events was largely down to being a narrative necessity. Since it was unavoidably established in her own movie that her powers border on godlike, her very presence would break the story as there would be few situations she could face either solo or as part of a team that she’d be unable to easily overcome, and so her absence was justified by her leaving Earth to help out on other planets similarly affected by the Snap but lacking a team like the Avengers to aid them.
It was initially planned for Carol to be part of the final fray from the beginning though, presumably appearing through a Sling Ring portal as part of the electrifying “Avengers, assemble” sequence. The book Avengers: Endgame – The Art of the Movie includes a storyboard from during the battle that sees her in flight and knocked out as she’s shot down by the orbital bombardment.
She’s saved from the cascading cannon fire by Pepper Potts as Rescue, who generates a shield around them and calls for help, whereupon the army’s female heroes surround the pair, fighting off the relentless assault of the Outriders until Carol reawakens and is able to power back up and launch her attack on the ship.
While this way of doing things in Avengers: Endgame would have made Carol Danvers’ reappearance not quite such a rousing moment of overpowered heroism, its alternative take on the A-Force shot that ended up used in the film, where they appear to afford Carol help she doesn’t really need to bring the Infinity Stones to the Quantum Tunnel, seem far less of a pandering inclusion, tacitly addressing the saga’s treatment of female heroes.