AC_DEFINE() takes HAVE_STD__SYSTEM || HAVE_WSYSTEM literally, meaning you
end up with the following in bitcoin-config.h:
/* std::system or ::wsystem */
#define HAVE_SYSTEM HAVE_STD__SYSTEM || HAVE_WSYSTEM
This works for the preprocessor, because HAVE_SYSTEM, is defined, just unusually. Remove this in favor of setting have_any_system in either case, given we don't actually use HAVE_STD__SYSTEM or HAVE_WSYSTEM, and defining HAVE_SYSTEM to 1 thereafter.