Macbook Pro 2012 MD101 cannot bootup, cannot reinstall OSX Problem Description
About 5 years ago, I upgraded the original HDD to SSD (Samsung 840 evo), everything was ok until last November.
After a trip to an examination (4 hours drive, 2 hours out, 2 hours back), when I turn on the power there is a Question Folder mark display on the screen.
Because this one is a spare computer, and there is no important data, so I tried to reinstall OS X. But after a long wait, the computer still cannot boot up, still question folder mark.
When I try to reinstall again,the SSD cannot be found in Install OS X Program or Disk Utility Program. I take off the SDD, connect it to a PC, and delete the partition, those Mac APPs can find it again, but Disk Utility Program cannot erase the disk, the erasing progress will be stuck on somewhere.
I thought this SSD is dead. So I replaced it with a new SSD. Try again, the same problem(After download files, reboot to continue to install will display Question Folder mark).
In addition to these:
I tried to reinstall from Recovery Disk. Still, the same problem.
I tried run Apple Hardware Test, did not find any problem.
After a lot of tries, when I erase the partition, this error popup:

Volume Erase failed
Volume Erase failed with the error:
POSIX reports: The operation couldn't be completed.
Input/output error

Conjecture
When I drive to then examination perhaps some bumps and shakes broke some part in the computer? I don't know.
It seems like the Part of SATA I/O or something on logic board goes wrong?
Update
I installed macOS to an external drive, it workes. I tried several times, and I found maybe the problem is the cable. I order a new cable online, I will try again later.
Update 2
After replacing the cable, problem fixed. :)
It sounds like you had a replacement SSD that WAS working at one time and has since failed. You then had some work done on the Mac or had some diagnostics done (?) but with no results.

Trying another SSD yielded similar results: the drive was not found to install macOS onto.

I am re-stating your problem to make sure I got it right.

What it SOUNDS like is that there is something going on with the storage subsystem. A cable, a connector or something on the system board (disk controller or the like).

You could examine all the connections carefully make sure there are no kinks or breaks in any cables associated with the disks. And if you still have the original working drive I would be tempted to try that, assuming it is still around and still bootable.

Failing all of that I would say that the issue is with the Mac itself and if a repair shop can't fix it what you have is an expensive door stop, unless you want to use the Mac with an external drive plugged into it (assuming that works...)