ESP32 WiFi Speed Based on Signal Strength

I have not approached this, but direct use of the ESP-IDF seems do-able:

https://medium.com/home-wireless/how-to-program-an-esp32-in-arduino-while-using-esp-idf-functions-90033d860f75

You may be able to use extern "C" { }
This forum post seems relevant
https://forum.arduino.cc/t/using-esp-idf-examples-in-arduino-ide/894646/5