When the USB connection is first established the host begins the communication at the lowest data rate and moves up in rate until the slave device responds. Then the slave id is sent to the host. This series of booting has already been done for the first slave device. If the connection is suddenly move to a new device, this discovery sequence will not be done, so the new slave device will not go through the discovery sequence.
Why not?
The microcontroller is designed in such a way that you will only need to switch when you want to update the peripherals driver on the secondary esp32
Because the host senses a break in the data lines when a new device is attached. The OP has no disconnect from one device to the other.
I'm not sure about your sequence of events when switching or how the entire system works but if there is an active device connected to the D lines then it should be told that a switch has occured if it actually need to know.
I have one USB-C connector that goes to the bridge IC. A switch is connected to the S pin to chose which ESP32 is connected to the USB connector. The switch is built in so you can simply switch it while it is offline and program the secondary ESP32. Afterwards it will be switched back to leave the communication to the main microcontroller. The main goal is simply to let both ESP32 be programmable without the need of a different connector or adapter. This will also be written down in the documentation of the project, as well as in the user manual. This switch will only be used when the driver needs to be updated. Once a new version of the program is on the microcontroller, the switch will be toggled again and left that way until the next update which will probably be never. I use this circuit just in case the people that use the microcontroller want to upload their own driver onto the ESP32.
Then you have no problem
If there is an IC that also communicates to the laptop, that the discovery sequence should be rerun, I would gladly include it in my design to get rid of malfunction posibilities.
The switch is built in so you can simply switch it while it is offline and program the secondary ESP32
Then there is no need for any other hardware.