[Bam.Core] Add suitable thread safety around fetching and caching node relationships, particularly for modules that generate executables that are subsequently used in the build