A way to determine a symmetric connector's position
Since the thing you are plugging in is pushing out a voltage relative to the ground pin on the Tx line (and maybe a pullup on the Rx) you ought to be able to use a circuit like the one below as a start.







simulate this circuit &ndash; Schematic created using CircuitLab

Pull each pin to ground one at a time and examine which other pins are driving back. You ought to be able to figure out which pin is the actual ground pin that way. Once you know that, switch in the TX/RX signals to the correct pins (not shown) and verify communication before turning on the appropriate power P-MOSFET. 

Once you know which one is ground, and have it powered up, detecting the plug getting pulled should simply be a matter of monitoring the transistor on the Vcc line.