Build-level environment fixes

- Fixed the implementation of "exclusive" in the list flattener.
- The global environments are now applied after tool loading when a
  configuration enviroment is being built, so that tools can continue
  to assume they don't need to worry about overwriting user variables.