Arduino is based on a precompiled ESP-IDF version, menaing the configXXX macros were set once, static .a files were generated, and are then included in Arduino-ESP32.
Changing the value of the macro after that fact has 0 impact on the .a file where the implementation lives. Meaning the include files will probably tell you that the function is available, but since the .a files are not recompiled, the implementation is still missing, and thus you can “undefined reference”.
You can resolve this by using the “Arduino as an ESP-IDF component” way (aka, framework = arduino, espidf) as shown in platform-espressif32/examples/espidf-arduino-blink at develop · platformio/platform-espressif32 · GitHub.