This fixes T92814 in a more general way. Hopefully we can get rid of the heuristic for socket selection at some point, but that's not something I'd do for 3.0.
Nodes can now specify which sockets should be linked when the node is dropped on an existing link. We could make this more specific in the future (e.g. having a default socket per type etc), but that's not necessary for now.