The problem is rather that the GNDs on both computers might be at a different potential and substantial amounts of current might start to flow once connected (read: something between computer A and computer B catches fire).
That is why all serious inter-computer USB devices use galvanically isolated connection (e.g. using optocouplers)
Most laptops and desktops will disable the USB port/controller or at least cut power to it.
It won't stop you from sending 200V into it and frying something, but it will stop short-circuits and faulty/non-spec USB devices from doing serious damage.
I guess it's a cheap safeguard that works pretty well for consumer products.
This won’t help you if the GNDs on both devices are different.
If the GNDs are different then neither device will be “providing power” in the traditional sense. Rather current will flow from the GND of one device to the GND of the other, and GNDs are normally not protected.
You will probably also see power flow on the V+ rails as well because they will be referenced against the GND in each device. In that case the devices can cut the power, but that only protects the V+ rail, not your GND rail that could still be transporting enough current to melt something.
They can still be plugged into different ground supplies. If they have different potential, you could get a large amount of current flow. If they're plugged into sockets in the same house, this is unlikely to happen.
This is usually more of a problem with audio equipment that has analogue signals with very high sensitivity. A ground loop can convert any nearby magnetic fluctuations (like say from the electricity flowing through the mains cables in the walls) into a nasty bit of noise.
Way back when computer to computer serial connections were a thing, you could get a cable that erroneously connected the power as well as the signal. Even if the two computers had the same ground, if the voltage regulator of one computer's power supply was slightly higher voltage than the other one, then it would try to power both computers, with the power flowing through the cable. This would tend to break either the cable, or the power supply. This particular thing shouldn't be a problem with USB, as the power supply has protection circuitry.
If you did this each device would provide +5V to the same line in the cable and nothing would happen (as there is no load). Same as if you had 2 batteries connected in parallel. If this was an issue than those ‘Y’ shaped USB cables that provide extra power for external HDD enclosures would also cause damage.
That is why all serious inter-computer USB devices use galvanically isolated connection (e.g. using optocouplers)