Anyone who has already tinkered with maintaining self-built software in a parallel subprefix (think Gentoo Prefix or MacPorts, on Mac) knows that the presence of headerfiles under /usr/local/include can be a problem, because compilers will have that location on their built-in list of standard include directories.
The usual -I stands for --include but there is no --exclude directive, sadly. There’s only an option to disable the entire built-in set of locations (and then add back a pruned set). Or even less elegantly, make the “offending” directory unreadable or move it aside, for the duration of a build where its contents would cause trouble.
But there has been so much development on sandboxing applications that I wonder if those techniques couldn’t provide a means to ban one or more locations for the top level command that launches a build (and all its children)?