It is not a matter of discipline. Avoiding this gotcha requires you to manually inspect your entire parent component hierarchy looking for uses of that hook - sometimes that is a plain grep away, but it is a very much invisible error. You also have to be familiar with the inner workings of the hook itself, and any other nested hooks, to verify if they use any local state or not. If it does, and you
need to share that state, well, that's a big rewrite which kind of defeats the initial argument.
Maybe extra tooling could be built to avoid this, if we weren't already drowning in linter plugins...