This is a fascinating and fruitful discussion that should enable any writer to add depth and complexity to a storyline.
There's a paradox at work theologically:
It might seem that grace (a gift given without the receiver's meriting it) is at odds with the protagonist's struggle.
What's the point of seeking to achieve a good goal if the successful outcome will happen anyway?
What's the point of trying to be a good person (overcome the shadow side), if you're never going to be good (deserving of grace) anyway?
How can the protagonist earn the ending if grace can't be earned?
I think the apparent problem shows up in a poorly plotted story, i.e. the undeserved deus ex machina ending.
This may be a resolution (which shows up in some of the greatest scripts): The protagonist MUST want / strive to achieve a good goal / become a good person, or the grace will go unused. (This is the thesis of C. S. Lewis' "The Great Divorce"). But the greater good is innately greater than the internal good of the protagonist. The greater good has no flaws.
You see this worked out in a lot of John Huston films--some time around the turn from Act 2 to Act 3, the protagonist fails / gives up, and then apparently by chance something happens to redeem the protagonist (give him / her a chance to continue the quest). In the African Queen, the two protags think they have lost (I don't remember the details, but they feel trapped / hopeless on the boat and then wake up to find they are not).
The deliverance is usually external in these Huston stories. In Capra / Riskin films, it's internal: the "dark night of the soul" provides the protagonist with the opportunity to move forward by giving up (recognizing her / his insufficiency).
I think even Billy Wilder--who's not overtly theological--works through this dilemma. The protagonist is typically an impostor throughout most of the plot, and has to confront / renounce being an impostor in order to achieve integration. That means giving up on the comforting false self that has protected but also limited the protagonist up to that point.
Of course, there are some directors / writers who renounce the possibility of grace--Roman Polanski, Woody Allen, Douglas Sirk e.g. But their stories of hopelessness make the hopefulness of other storytellers possible, because they show that a grace-filled outcome is an option, not a necessity.
Other writer-directors like Paul Schrader and David Lynch navigate the gamut between hope and despair, but they're harder to pin down in terms of an ultimate theology (or theodicy).