As a discovery writer, I echo the sentiment that I absolutely control the direction of the story.
I personally write with an end in mind; which I record as notes (not prose) about what finally happens; what is revealed, etc.
I very much do give my characters personalities and proclivities; while writing I feel like they are real people I know, and will only write for them actions, dialogue and ideas consistent with their personality. So, for an extreme example to illustrate my point, I am not going to force my virgin sidekick to volunteer to seduce a guard because that would be a convenient distraction. My devout priest isn't cutting any throats.
But giving my characters loose reins doesn't make me obligated to follow every move that occurs to them. I aim for their most plausible (or most conflict-producing) response, but even us real people have a handful of plausible responses to deploy in most situations. We do it, we don't do it, we find a safer way, we find a more dangerous way because we are impatient. We get angry, or get angry and control ourselves. We act on our love, or hide it with nonchalance, or hide it and suffer because it is doomed or wrong or breaks a vow.
I don't mind detours, but if I as an author am much attracted to a great idea I had whilst writing a scene, I have a rule: If that makes my current notion of the ending no longer viable, I must come up with a better ending, or think harder and rewrite the scene in some other manner to preserve my current better ending. I have to choose from a different but plausible reaction for my character(s). If that seems impossible, and I've written myself into a corner, then I unwind more of the story until I am no longer in a corner.
When I am in a corner it is not that there is NO ending if I keep writing, it is that I won't know the ending or I know it won't be good; e.g. I write reasonably happy endings. I will note that Stephen King is a discovery writer that does the same thing; while writing The Stand he said he discarded months of work because he wrote himself into a corner.
I control the story. I know good stories will fit pretty well into the three act structure and their timing points; that is something I expect to see emerge as I am writing; another compass to keep me on path. Unlike plotters I don't plan these ahead of time; but the three act structure was derived by analyzing a lot of pre-existing successful stories and taking averages; it describes what successful storytellers were doing naturally, by instinct and experience. So I have a "feel" for how long my hero needs to show us her normal world, when she needs to be ejected from it, when it is time for her path to change and something new to happen.
If you don't have a feel for that yet; read up on the three act structure and where the inflection points are.