Fixes a block of code which seems to be incorrectly performing two existence checks instead of catching and logging errors. fs::remove returns false only if the file being removed does not exist, so it is redundant with the fs::exists check. If an error does occur when trying to remove an existing file, fs::remove will throw.
This is a backport of core#26828