Macbook doesn't want an SSD
It's the cable. The internal disk flex cable connecting the disk to the motherboard. Trust me, I have seen these symptoms dozens of times with the MacBook Pro 13&quot; 2012, and it can really give extrmemly weird problems, of the sort you describe.
You need a new cable, the only problem is knowing which one. The 2012 MBPs use one of 3(!) different identical looking disk flex cables with different model numbers. First check which one you have, lift the connector from the motherboard and look on the underside of the cable on the part. The model number will probably be either 821-1480 or 821-2049. If it is the former it might need to be replaced either by the same, or the 821-2049. If the latter, it will need a replacement with the same model, 821-2049.
If you only get one new cable to try, I would bet on the 821-2049. Regardless, it's that cable, there's your problem right there.