This is also why expensive local storage on macbooks is so frustrating.Don't make the fatal mistake that many people do of confusing backup with cloud syncing! iCloud might be a recovery option if your local storage device fails, but if you accidentally delete or overwrite something, a file gets corrupted or your files get infected with malware then all of that will also be reflected in your cloud-based files.
I still remember reading a desperate post from a few years ago where a user had wiped his local photo library as it seemed to be corrupted, with the intention of restoring it from the cloud, but when he'd deleted every photo locally, that deletion had been synced to his cloud-based library meaning he lost everything - including all the photos of his children growing up.
People here will say to just use iCloud and 'manage storage', resulting in a single version of the file in the cloud which could be deleted easily.
Dealing with proper data backups and Apple is very expensive unless you are willing to use a NAS or external USB drive.