According to the director Gareth Edwards, Rogue One was originally structured to have a very different ending than what we have now.
The director Gareth Edwards revealed this information while talking in an interview and also said that going with the ending formerly scripted for the movie would have given the movie a different meaning altogether.
"The very first version, they didn't. In the screenplay. And it was just assumed by us that we couldn't do that. 'They're not going to let us do that.' So I was trying to figure out how this ends where that doesn't happen," said the director.
"And then everyone read that and there was this feeling of like, 'They've got to die, right?' And everyone was like, 'Yeah, can we?'" He added.
Gareth continued saying, "We thought we weren't going to be allowed to but Kathy [Kennedy, President of Lucasfilm] and everyone at Disney were like 'Yeah it makes sense/I guess they have to because they're not in A New Hope.' And so from that point on we had the license."
"I kept waiting for someone to go, 'You know what? Could we just film an extra scene where we see Jyn and Cassian, they're okay and they're on another planet?' And it never came. No one ever gave us that note, so we got to do it." He stated further.