It seems as if Captain Marvel went through a lot of changes during production as not only was Mar-vell unfortunately changed, a neat Jude Law Yon-Rogg post-credit scene ditched, but it is also learned there was an alternate ending.
Editor Debbie Berman offers an ending she didn't want to go with (spoiler warning):
I did actually suggest some tweaks to the ending of this film. It used to end with Carol flying off into space alone, and I found that a bit jarring. Like, where exactly was she going? And what was she doing? It felt like we needed a stronger visual to assert a more specific justification for her leaving and disappearing for so many years. So we added Talos and his family in their spaceship waiting for her, and they all fly off together. It gave her more of a sense of purpose and made it easier to believe that she left her newfound life on Earth because she was with a friend we knew she cared about, and for a more specific mission. It gave more resonance and closure to her final moment in the film.
I think Berman's reasoning makes sense, as the ending they used, we are led to believe that Captain Marvel goes with the Skrulls to continue the fight with the Kree. However, what I liked about the ending is that, IMO, it leaves it open for the Skrulls to still be bad guys. While the comic book creator behind Carol Danvers didn't like what was done with the Skrulls in the movie, I found it a nice twist. We can probably add that in this situation, Talos was most concerned about finding his family, which is why he came off as a good guy. Talos said it himself in the movie that he has done a lot of bad stuff, so it's not like the Skrulls in the clear. If they ever do a Captain Marvel 2 that involves the Kree Skrull war, perhaps Carol will realize they are both bad?
(via ET Online)