Error compiling chaos due to windows.h min/max defines

I have updated our project from 4.26.2 to 4.27.2 and I have the following compile errors in one of Chaos classes:
image
In the following lines of code:

CollisionVertices.AddUninitialized(std::min(NumGoodPoints, static_cast<int32>(ceil(NumGoodPoints * Fraction))));
NumGoodPoints = std::min(NumGoodPoints, static_cast<int32>(ceil(NumGoodPoints * Fraction)));

I’ve found the reason is windows.h include has defines of min and max and in order to make it not break other code it’s recommended to use #define NOMINMAX before the include or #undef max
#undef min after

I added it to all our classes which have the include:
#define NOMINMAX
#include <windows.h>
#undef max
#undef min

but windows.h include is used multiple times in the UE code without any NOMINMAX, so, it didn’t help.
My questions are:

  1. How to fix it without changing UE code and recompiling the engine?
  2. Why I am the only one with this problem with the chaos class (googled, no other cases like mine with this class)
    UPDATE: Found a topic with a similar problem, where it was solved by switching to VS 2019, I installed VS 2017, 2019 and 2022, tried all the compilers, doesn’t help.
    UPDATE2: As a temporary solution i removed read-only status from the file and changed the code of the Chaos class replacing all std::min with (std::min), but an answer how other people can live with this would be very much appreciated.