I've learned somewhat superstitiously that if I don't connect and disconnect the USB-C cables in the right order the laptop may stop responding and I have to do a hard reboot. I thought this solved the problem but even now it still occasionally happens.
Your question makes me wonder if something like this isn't the cause (Mac misreading USB-C signal).
So yes, it is possible to detect which end gets connected first, but this absolutely shouldn't have any side-effects. It is unintuitive and fragile (if the 'master' device restarts, it will think the other end connected first, suddenly becoming 'slave').
Device A receives the cable first, upon receiving the cable, Device A notices that the cable is not "hot" ("hot" in the sense that there is voltage/activity on the wire), so then Device A decides to "turn on" the cable, make it "hot".
Now Device B receives the cable, it notices that the cable is already "hot" and decides that it must be the second device.
I would imagine it could work that way,
Im also pretty sure that the usb cables are "dumb" cables and not active cables like QSFP (these have chips at each end).
This is all done before power is applied, as USB Type C is very explicit about not going hot (apart from a weak 5V V_conn for powering the cable).
Also, QSFP is not a cable, but a pluggable spec. A QSFP module is active, but the fiber optic cable you connect to it to is dumb. Link detection there works by sensing beam power.