I think this is a rare problem on XJ's. I have had problems with my 95's tachometer dropping out in heavy rain, due, apparently, to moisture getting into the connector.
Have you tried some kind of contact cleaner, or terminal grease? You might also want to look very carefully (magnifying glass in hand) at all the prongs on the plug, to see if one is distorted, damaged, corroded, etc. Some plug contacts have a little prong or ear that can be very (very very very) carefully pulled outward to improve contact. The ones on an ECU may be so small that you will need a dental pick or the like to do it.
It might also be a good idea (not always easy) if you can try to isolate the problem definitively between the plug and the wires going into the plug. IN other words, is the problem solved when the plug moves in the socket, or is it really the wiggling of the wires? Depending on how everything is bound together this can be tricky, but try wiggling the plug without touching the wires, and see whether this works as well.
Most XJ ECU plugs are held to the ECU with screws, to prevent them loosening. Is it possible that yours was supposed to have such a screw but doesn't?
Of course there's also the possibility that the fault is really in the ECU, a poor solder joint, bad contact, or whatever. Good luck.