chore: extract `set_run_flags` logic as named helper (#10012)
### Description
Refactors the logic in `run` related to setting run flags into a named
helper.
If you're not dealing with `Watch` or `Run`, this logic is a barrier to
understanding how `run` works, extracting this logic into a helper makes
it easier to read `run`'s logic.
The `set_run_flags` helper uses the same mutation of `command` that was
previously present in the `run` function body, but future work could
include removing the necessity for mutation.