One option is whenever. Another is via some form of random encounter system. And another is when a player fails a roll, and hence doesn't get what they wanted in the situation.
All of these produce different aesthetics, however, which is what you're not really acknowledging. The method makes a difference in how the outcomes are perceived, and the perception is then weighed against preferences.
There isn't one true way, but people aren't wrong for not finding one way to their preferences, even if their dislike is strong enough to be considered criticism. Particularly when even under the premise of preferring a particular option, the option may not actually be ideal.
Thats why Crimson and others pointed out that it isn't logically sensible that one's skill in Cooking has anything to do with why the Bandits showed up, which is a consequence of having the roll be used simultaneously to advance the scene
and be an emulation of the characters skill at a given task.
Ergo, one solution in the premise of wanting to ensure the narrative continues could be the Tension pool, as I noted, which just splits the roll into its parts.
Another is just not leaving the chance of the Bandits showing up to a roll. You stopped to Cook > they show up is a lot more logical than the actual act of Cooking having any influence on that matter.
But by asserting that there must be a random chance of this
and combining it with a task-resolution, you are creating a gamey solution to a practicality concern (how to be the most efficient at accomplishing both objectives) at the cost of logic idiosyncrasies.