Is There a Way to Suppress C++ Errors/Warnings in Unreal Engine Headers?

I want to catch some possibly dodgy behaviour in my code by using the provided build settings in MyProjectEditor.Target.cs and adding this line:

UnsafeTypeCastWarningLevel = WarningLevel.Error

But if I do that, I get 52 different errors in the Unreal Engine headers even when there are none in my code. This stops the project building. This happens even on a blank C++ project, so this option seems to be completely useless.
Does anyone know if there’s another flag that says ‘just report errors in my code, not the engine’?

I’m using UE 5.0.1, VS 2019 for a PC-based project.

UE 5.1 Update:
Interestingly, in UE 5.1 setting this option results in a different, compilation blocking error:
<X>ProjectEditor modifies the value of UnsafeTypeCastWarningLevel. This is not allowed, as BlankCpp51ProjectEditor has build products in common with UnrealEditor.
Which is irrelevant in the case of this flag as it has no effect on the build products, it just produces additional compiling information. The suggested solution of compilng UE 5.1 from source with this flag enabled has absolutely no chance of success, but it would keep you busy for several hours finding that out.