MacBook Pro Mid-2012 SSD suddenly extremely slow
I've also struggled with the same Macbook type and encountered a similar problem. Replaced the HDD with a SSD and it worked for almost two years, until the Mac became really slow.
Looks like the SATA cable is broken and needs replacement. See these ifixit instructions for the replacement.
The SSD I've used was a SanDisk SDSSDA-480G which is really slow now, even when I put it in an USB enclosure on another Mac. Writing is now limited to 2MB/s, while reading is still faster (around 250MB/s). I've verified with a different SSD and HDD that the enclosure isn't the problem for those low speeds. Looks like the disk is also damaged as side effect from the SATA cable.
I've replaced cable and SSD with new components and the same machine is now fast again.