Yes, except if you select the fast boot option in the config page; in this case the module start to run immediately doing the connection in background.Understood. Does it mean that on startup, the ESP will potentially delay up to 25 seconds (while waiting on Wifi connection) before your code starts running?
This has been implemented mainly to kill the wifi connection (doing a WIFI.SLEEP at the beginning) if you want use the module without wifi.
In your case you can just leave as it is and the module will try to connect with the router in background; you can eventually, in the code, check regularly the connection and retry again using WIFI.CONNECT
Now that you know how to do, is just a question of learning.This "save before run" tip is extremely important and explains why I was confused at some of my experiment code not working (because I didn't save the code in the editor before running, so I was running old unmodified code!
I think to avoid doubt it might be a good idea to:
1. Edit the tooltop text (that appears when mouse is over RUN button) to include "You must SAVE your code before RUN for changes to take effect"
2. Is it possible to have a "CodeHasBeenEdited" flag that is reset by SAVE/SAVEAS button and set by any change in edit window? RUN button would then check flag and if code has been edited but not saved, the editor could ask whether to SAVE then RUN. This would help a lot towards preventing RUN without SAVE after editing code.

The only thing I could add is a flag that change as soon you modify something in the code, with a message indicating that you changed something in the code and you should save (or propose automatically to save).
But I don't know if this worth an effort ...
About the ping, it must be used as a function so something like
Code: [Local Link Removed for Guests]
wlog ping(.....)
p.s.
I'm still curious to understand why you need a 4msec cycle.
Is for filtering or to measure the length of the pulses?
Do you need an action at each pulse or just count is enough?