I had a similar issue on a 2011 iMac. I was trying to upgrade to a SSD, and it simply would not take it. I tried multiple SSD’s, , cloning before putting it into the drive and booting from the new SSD externally(which worked when external) different format schemes, formatting using terminal, MacSales tech support, additional thermal sensor adapter, you name it, etc. Everything. I ended up putting the old HD back in and it worked fine. Total mystery. No solution.