There will never be a day in Hollywood where story impact over-rules financial possibilities when it comes to big money film franchises. If studio bosses get wind of the popularity of characters, through focus groups, you just know the next cut of the movie will see that character pushed to the fore-front.
Even when they're supposed to be dead.
There's seemingly no amount of dead that studios won't change, even after they've been filmed and in some cases screened to actual members of the public. If it's not right for the continued sales of the franchise, it's not going to happen, and that seems to count particularly strongly when a writer or director has the audacity to kill big name characters off.
In the borrowed words of one executive faced with the prospect of a classic Stallone character being killed off "these people don't die."
In some cases, the actors themselves are the ones pushing to be killed off, in others, directors or writers end up being over-ruled - whether because of lost merchandise sales or character popularity. If there's even the slightest chance of a money-spinning sequel appearance, you just know that death isn't getting signed off. And you'd be surprised by some of the near misses we've seen over the years.
Well, he's dead now isn't it, but he was originally supposed to be killed off well before he bit the dust in The Force Awakens.
As well as Harrison Ford publicly expressing his opinion that Solo should have died at the end of the first trilogy, screenwriter Lawrence Kasdan seriously entertained writing that fate for the iconic character. The original plan would have seen him killed while trying to destroy the shield generator, but George Lucas apparently intervened because in Ford's words he "didn’t think there was any future in dead Han toys."