How to identify a corrupted file system early
This is what SMART status is for.

I use a product called DiskDrill, that besides the recovery tools (paid) they have a number of free utilities including a SMART status monitor that will warn you proactively if a number of erros start popping up.

As for you data, the best approach is the "ounce of prevention is worth a pound of cure" approach.  Create and stick to a back up plan where you have not one (Time Machine) backup, but a secondary (like iCloud and OneDrive).  When you have multiple copies, you greatly reduce the chance of data loss.