Leaving aside the correct advice to avoid such hard coded backup files, I wish people would recommend at least considering "sudo -e" instead of "sudo $EDITOR" when editing something important with root permissions.
Malicious processes running as the same user could potentially modify the file, but if you have malicious processes running as a user with sudo privileges you have probably already lost.