By “UBT reflection” you mean UnrealHeaderTool (UHT), it’s that complitly different tool, UBT only manage compilation process and it runs UHT to do header processing work.
For this kind of things you have build scripts (*.target.cs and *.build.cs), they indeed don’t have file exclusion, but you can alter include paths in *.build.cs, this file shows all varbales you can put in ModuleInfo:
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Programs/UnrealBuildTool/Configuration/ModuleRules.cs
This one is what you looking for:
/// <summary>
/// (This setting is currently not need as we discover all files from the 'Public' folder) List of all paths to include files that are exposed to other modules
/// </summary>
public List<string> PublicIncludePaths = new List<string>();
which let you add extra public (accessible from other modules, or else use PrivateIncludePaths) include files
There also this allowing to removed default include paths and add your own
/// <summary>
/// Whether to add all the default include paths to the module (eg. the Source/Classes folder, subfolders under Source/Public).
/// </summary>
public bool bAddDefaultIncludePaths = true;
Now to get engine version you need to read it out, it has nothing build in as UBT is made to work with everything else then Unreal (like ThirdParty libraries):
BuildVersion Version;
if(!BuildVersion.TryRead(out Version))
{
throw new BuildException("Couldn't read engine version");
}
And from Version you can read MinorVersion which should be the X number (4.X)
Here you got a file:
https://github.com/EpicGames/UnrealEngine/blob/f794321ffcad597c6232bc706304c0c9b4e154b2/Engine/Source/Programs/UnrealBuildTool/System/BuildVersion.cs
Sadly you can add extra definition to UHT as it’s hardcoded in UHT code, i checked and adding new once require some extra code in few places. So try method mentioend above, i didn’t test it myself, but it’s worth a try, better then nothing. Biggest unknown is if UHT honors UBT include paths configuration or it goes stright to Public and Private directories. UHT process header files that are included in cpp files, so i think it should work as long as UHT looks in to include paths configured in UBT, for a test to put include file in non-default directory and see if UHT will work properly with such configuration