Your car ac pressure switch seems alright, in fact it is the defective two pin connector which is making issues that attaches on top of it and popping out loose due to engine vibration.
There is a locking tab in the connector check if that is not broken also check there is no foreign material, road dust/grime inside the matting surface of the pressure switch attaced to the dryer bottle.
Take photos of the connector and buy a similar one from scrap but before replacing the connector check the new one by inserting it fully and see if it clicks and locks fully.
You actually don't need to cut the wires and attach the new connector, it can be easily done by de-pinning the old connector.