This stacktrace shows you’re still stuck in setup() with that while loop of checking the status() and doing a digitalWrite.
while (WiFi.status() == WL_CONNECTED)
{
digitalWrite(LED_BUILTIN, HIGH);
}
this will block the entire time you’re connected to WiFi and does not do what you want! If you are connected you call digitalWrite a million times with HIGH while not feeding the watchdog and blocking further execution, but if you’re not connected, you break out of the while loop, while not setting the built-in LED to LOW to indicate the other state. You should implement this “turn LED on/off if connected to WiFi” check periodically in the loop() as one single if statement (or ternary expression) as I’ve explained in ESP32 WiFi Yes, ESP8266 No - #2 by maxgerhardt, or even much better, use the WiFi event hooks! See example and lib code.