I have similar experience before, and this is due to a corrupted network configuration, and when the external NIC in the dock is plugged in, the kernel panic is triggered. I end up solving this problem by going to the network settings, and create a new network location the delete the default one. You can follow Apple's guide on how to change your network location:
https://support.apple.com/guide/mac-help/use-network-locations-on-mac-mchlp1175/mac
This may not be the exact problem you are facing, but you can have a try.