How do I upgrade my internal SSD using a third party if my current one is not recognized (failed)?
Even though it's a "vintage" Mac, it's worth taking it to an Apple Store, if there's one near you, and see if they will look at it and what they would charge. I've often been pleasantly surprised.

Alternatively, you can often find secondhand Apple SSDs for these Macs on sites like eBay.

FWIW, you should be able to install MacOS via target mode from another Mac: I've done so with a 2014 MBP, for instance. The fact that you can't might be a result of the hardware fault.