CMake allows 'add_subdirectory' to differ by case from the file-system casing. In that scenario - when GetScopedTargets is looking for scoped targets, the value obtained with:
$Folder = $CodeModelConfiguration.directories[$_.directoryIndex].build
...is cased as described by CMake, but the $ScopeLocation is cased according to the file-system. As a result, the $Folder.StartsWith($ScopeLocation) call won't match.
This discrepancy manifests with scoped builds (i.e. building from a folder underneath the CMake root) not finding targets in folders that have casing that is mismatch between the file-system and CMake.