How to reinstall macOS - Apple Support explains:
- If the installer doesn't see your disk, or it says that it can't install on your computer or volume, you might need to erase your disk first.
You can do that as long as you are willing to sacrifice all the information on that Mac. If you need to retain its contents, then you will need to start your Mac from another device, such as an external hard disk drive or flash drive. Might that be an option?
Change your Mac startup disk - Apple Support: Shut down the Mac, connect that device, then press and hold an option key while starting the Mac to choose it as its temporary startup disk.
If you have or can borrow another Mac, you might be able to start yours in Target Disk Mode: Transfer files between two Mac computers using target disk mode - Apple Support.
Either option may give you the opportunity to back up that Mac's files prior to erasing it.