Store matching files in iCloud AND on Mac and Macbook
First and foremost: iCloud is not a backup service. In order to achieve what you want, you need backups!
You can use various forms of backups to realize your goal: For example you could use the built-in Time Machine software with external USB-drives in order to have a complete backup that you could store at a seperate location. You could also use a cloud service such as Backblaze, SpiderOak or similar.
That being said, you can avoid the Mac removing files from your local disk to free up space by opening up System Preferences, click Apple ID and then remove the check mark from Optimise Mac Storage.