Those bad boy Star Wars writers didn't think they could get away with it: Would Disney let them kill literally everyone at the end of Rogue One? It seems like a crazy idea. Disney would never allow it, right? What about the sequels? What about the children? Won't somebody think of the children?!
In an interview with Comicbook.com, Rogue One screenwriter Gary Whitta revealed that he and director Gareth Edwards knew that all the characters would have to die in the movie, but thought Disney would never let it happen. So, they originally drafted a different ending that would fit Disney better.
We always felt that it was the right thing to do, that these characters make the ultimate sacrifice. It wasn't that way in my original script, but again, we never felt that we would get away with it. K-2 always died, but Jyn survived in the very first version of the movie that we developed, and then it was Gareth who kept pushing for it, saying, "I feel like they need to die. They need to die." Eventually he convinced [Disney and Lucasfilm].
But, surprisingly, Disney was "fully supportive" of this tragic ending, and a now a generation of children are traumatised because of it.
As we know, Rogue One underwent some substantial last-minute rewrites and changes before it was released. Most recently, we learned that the movie almost had a whole lot less Darth Vader in it. In another interview with Entertainment Weekly, Whitta goes into more detail about this original ending, saying how Jyn and Cassian survived and escaped the planet:
A rebel ship came down and got them off the surface. The transfer of the plans happened later. They jumped away and later [Leia's] ship came in from Alderaan to help them. The ship-to-ship data transfer happened off Scarif ... They got away in an escape pod just in time. The pod looked like just another piece of debris.
Thankfully they went for the more depressing ending instead.
[h/t: AV Club]