I have no idea where the temporary file is coming from. I just looked, and I saw the following in the Tramp debug log while editing file /etc/prometheus/prometheus.yml on the remote host with the sudo method:
I think the temporary file is coming from option 'file-precious-flag', which I enabled after getting file corruption when saving over unstable links. I'll ask the Emacs guys to improve the temporary filename. Regards, rdiez