Fix building multiple modules with shared excludes

If module A & B both require module Z but also are set to exclude it,
after build, A & B don't contain Z as expected,
but module Z is empty.