@jerome While @mdma was replying - thanks @mdma (you rock as always!) I wrote a test app that let me see that WiFi.listen()
does not return unless you provide WiFi credentials. The listen mode has two commands (AFAIK) 'i' for getting the core ID and 'w' for setting WiFi credentials. So you will need to have an timer interrupt that function and you can shut down that mode and continue in your application. (NOTE: going into listen mode currently closes any serial connection and so any debugging on that port - you will have to re-establish the serial connection to continue)
Here is some work previously done by @peekay123 with timers.