Excellent question, and yes, I definitely wrestle with this, and have especially wrestled with this earlier in my novel-writing career, when I was still getting my sea legs as to how to write the best first draft possible. Because I am a pantser - as in, I don't outline, I don't have much of a clue what's going to happen, and I write by the seat of my pants - I often find, as you have, that the characters go places I totally didn't anticipate. In the manuscript I just completed (but, I'll note, haven't yet revised, which I'm sure will cause further changes), one of the main characters was a late entry into my imagination, and in fact, wasn't even part of my original idea, and the second half of the book took on a life of its own: I literally NEVER imagined what ended up happening was going to happen.
For me, this method works. I feels organic, honest and allows me to, I hope, create characters who aren't shoved into contrived circumstances because I deemed said circumstances necessary to get from point A to point B.
But. This method also means that yes, I often have to go back and tinker with what I've previously written. When I discover a disconnect, I go back and amend it right there and then. But this is because my writing and the plot tend to snowball...if I, in the back of my mind, know that there's some incongruity in the plot or the characters, I have a difficult time getting to the mental place I need to imagine their current lives or situations. (Wow, that's a really ambiguous sentence.) What I mean by that is that if I'm hung up on the thought of knowing that I need to change a character's past behavior or past life, it's hard for me to fully imagine their future behavior or their future life, because, as a pantser, all roads lead to the page I'm currently on. If something needs to be changed on page 56, well, then it's going to affect the outcome of page 102. Make sense? So I go back right then and rework it.
As I said, I've gotten better about this with every book I write because I have a much better understanding now of what I have to do to create tension, accelerate the plot, give the characters depth, etc. So I fall into fewer sand traps as I go. I guess my advice is to really ruminate on the action before you put it down on paper. Even though I might not spend my entire day writing, I do spend a lot of my non-writing hours mulling over what's going to go on the page when I do. I don't just sit down and write to write...I've long since hashed out WHY I'm asking a character to do something and WHERE this is going to lead to in the plot. If their actions make sense and propel the plot forward, then for the most part, I'm safe.
Anyone else deal with this? Do you go back right there and then to fix things or keep chugging along to get to the finished product?