I realised from dmesg on Pi Zero W that machine.reset() on /dev/ttyACM0 causes the Pico W actually connecting back on /dev/ttyACM1 for some reason:
[ 1782.275948] usb 1-1: USB disconnect, device number 2
[ 1782.476026] Indeed it is in host mode hprt0 = 00021501
[ 1782.895736] usb 1-1: new full-speed USB device number 3 using dwc_otg
[ 1782.896170] Indeed it is in host mode hprt0 = 00021501
[ 1783.279255] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
[ 1783.279305] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1783.279325] usb 1-1: Product: Board in FS mode
[ 1783.279341] usb 1-1: Manufacturer: MicroPython
[ 1783.279357] usb 1-1: SerialNumber: e6614c311b903c31
[ 1783.297138] cdc_acm 1-1:1.0: ttyACM1: USB ACM device
I can change the interpreter in Thonny to this new device and now machine.reset() on this new /dev/ttyACM1 causes the Pico W connecting back to /dev/ttyACM0 again:
[ 1913.026915] usb 1-1: USB disconnect, device number 3
[ 1913.226846] Indeed it is in host mode hprt0 = 00021501
[ 1913.596674] usb 1-1: new full-speed USB device number 4 using dwc_otg
[ 1913.597136] Indeed it is in host mode hprt0 = 00021501
[ 1913.948698] usb 1-1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
[ 1913.948748] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1913.948768] usb 1-1: Product: Board in FS mode
[ 1913.948785] usb 1-1: Manufacturer: MicroPython
[ 1913.948800] usb 1-1: SerialNumber: e6614c311b903c31
[ 1913.968457] cdc_acm 1-1:1.0: ttyACM0: USB ACM device