Does UBT flatten source directory structures, creating header file name collisions?

Build issue, looking for advice if anyone can help.

I’ve got multiple source projects in a single game module.

I suspect that UBT is flattening my source directory structures, creating header file name collisions.

e.g. “Bar.h” conflicts with “foo/Bar.h”, but only at build-time, not in the IDE. N.B. Class names differ [ ABar / foo::Bar ], so this appears to be a file naming problem.

Is this expected?

Is there a UBT option to respect directory paths at build time?

Error:

UnrealBuildTool : error : Unable to merge actions producing Bar.cpp.obj: prerequisites are different [G:\filestore\development\unreal\foo\Intermediate\ProjectFiles\foo.vcxproj]
UnrealBuildTool : error : Action graph is invalid; unable to continue. See log for additional details. [G:\filestore\development\unreal\foo\Intermediate\ProjectFiles\foo.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""P:\filestore\games\Epic Games\UE_4.27\Engine\Build\BatchFiles\Build.bat" fooEditor Win64 Development -Project="G:\filestore\development\unreal\foo\foo.uproject" -WaitMutex -FromMsBuild" exited with code 6. [G:\filestore\development\unreal\foo\Intermediate\ProjectFiles\foo.vcxproj]"

Code:

[Private/Bar.h]

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Bar.generated.h"

UCLASS()
class FOO_API ABar : public AActor
{
    GENERATED_BODY()

public:
    // Sets default values for this actor's properties
    ABar();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:
    // Called every frame
    virtual void Tick( float DeltaTime ) override;
};

[Private/foo/Bar.h]

#pragma once

namespace foo
{
    class Bar
    {
        Bar();
    };
}