Can Windows Automatically Repair Errors?

My computer crashed 2x this week because I deleted some files that the OS need. I'm trying to save some memory and not being a computer savvy, I accidentally erased important files.
Is there a way for Windows to automatically repair errors whenever it sees that there is a corrupted file in the registry? Though there are a lot of possible problems, the errors are pretty much the same and I know that it will be easy for Windows to tell what the specific problem is.
I think it will be very helpful if Windows would atleast warn customers that the deleted file was necessary for it to function properly.
