It may be better to rewrite this as a function that returns the list of backends to use.  (See my lower comment about implementing it as selection instead of exclusion.)

Generally mutating global state is bad but it can be mitigated by not letting the mutation permeate through multiple levels of the stack.