For some reason I don't understand, the dragged link is sorted across all the node's multi-input sockets.
This leads to problems when there are multiple sockets to sort.
With this patch, I'm making the feature work more directional.
Video illustration of the problem:
Discovered during development: T103457: Attribute Map node