If you don't load hyperref, then you'd get
macro:->\T1-cmd \textasciitilde \T1\textasciitilde
although the default encoding is EU1 (or EU2 with LuaLaTeX).
With hyperref you get
macro:->\PU-cmd \textasciitilde \PU\textasciitilde
because puenc.def has been loaded later. The macro \PU-cmd looks for two arguments and does
\ifx\protect\@typeset@protect
\@inmathwarn#1%
\expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
\expandafter\ifx\csname ?\string#1\endcsname\relax
\expandafter\def\csname ?\string#1\endcsname{\TextSymbolUnavailable#1}
\fi
\global\expandafter\let\csname\cf@encoding\string#1\expandafter\endcsname
\csname ?\string#1\endcsname
\fi
\csname\cf@encoding\string#1\expandafter\endcsname
\else
\noexpand#1%
\fi
The arguments are \textasciitilde and \PU\textasciitilde (which is one token).
In normal typesetting, \ifx\protect\typeset@protect is true, so \@inmathwarn\textasciitilde is expanded, but it does
\ifmmode \@latex@warning {Command \protect #1 invalid in math mode}\fi
so nothing happens unless we're in math mode. Then LaTeX checks whether
\EU1\textasciitilde
(one token) is defined which it is: \cf@encoding is expanded to the current output encoding. If it weren't, in the usual sense that \EU1\textasciitilde is equivalent to \relax or undefined, LaTeX would look for \?\textasciitilde (a default text command) and, if a definition for it is missing, an error message would be defined for further usage \EU1\textasciitilde would be globally made equivalent to \?\textasciitilde.
Finally, \EU1\textasciitilde is expanded.
In case the first conditional is false (that is, we're writing to files or in other special places), just \noexpand\textasciitilde would remain in the input stream.
You see that PU never intervenes, unless \cf@encoding is PU, which happens when hyperref is doing its work of writing the bookmarks.
PUorPD1, depending on the engine or options tohyperref(with theunicodeoptionPUis forced also forpdflatex). Also hyperlinks use the internalhyperrefencoding, I guess. – egreg Aug 31 '14 at 17:57