Many more things will fail with \immediate\write.
I suggest getting an “immediate” version of \protected@write:
\documentclass{article}
\usepackage{xpatch}
\makeatletter
% get a copy of `\protected@write
\let\protected@iwrite\protected@write
% patch the copy to add \immediate
\xpatchcmd{\protected@iwrite}{\write}{\immediate\write}{}{}
\makeatother
\newwrite\titlefile
\begin{document}
\author{A. Uthor}
\title{A title with \'accent \\ and new~line}
\immediate\openout\titlefile=\jobname.title
\makeatletter
\protected@iwrite\titlefile{\def\\{--}\def~{ }}{\@title}
\immediate\closeout\titlefile
\makeatother
\maketitle
\end{document}
See https://tex.stackexchange.com/a/110885/4427 for further information.
With this setup, the file \jobname.title will contain
A title with \'accent -- and new line
\\should be replaced with? – egreg May 27 '18 at 09:32--). If it fails with accented letters would be a problem too. – mmj May 27 '18 at 09:35