Couldn't a malicious actor edit the temporary file without the user who invoked sudo -e noticing?
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.