It’s going to be hard to know unless you isolate the failure by replacing a part and seeing if that fixes things.
The PCIe based storage drives can be swapped, so that upgrade might let you know. Have you booted to recovery and tried to make a backup? Once you have your files, you can run disk utility and disk information from recovery to see if the storage is detected or has errors.
If you are good with small repairs, and can ground yourself properly, reseating the storage would be the first thing a technician tries. Then they apple run apple service diagnostics a second time if the first run had no errors.
Things this could be is a corrupt EFI (zero the drive, install a clean OS - Mojave or newer if possible and fully patch the system, including firmware updates), bad cables, bad drive, bad controller or logic board.
It’s not the OS since the system would show the drive even if the OS was gone or corrupt each and every time you tried to boot the Mac from internet recovery or an external media.