From the amsmath documentation (section 15.2 Implementing tags and labels, p 39):
Sometimes it is necessary for a \tag command to store a tag in a safe place
and to process it later, e.g., for a tag in a row of an alignment where the tag
can only be typeset when the \\ at the end of the row was seen. Such a tag is
stored in the macro \df@tag (for ‘deferred tag’). For this purpose we provide
the \make@df@tag macro. It is built very similar to the \maketag@@ macro [..].
\let\df@tag\@empty
\def\make@df@tag{\@ifstar\make@df@tag@@\make@df@tag@@@}
\make@df@tag sets \@currentlabel and defines \df@tag appropriately.
To simplify the task of tracking \tag and \label commands inside math display
environments, we defer \label commands until the tag is typeset, similar
to the way that \tags themselves are deferred. This allows arbitrary placement
of \label and \tag commands and also means we only increment the \equation
counter when we really need to, thus avoiding the \setb@ck nonsense that used
to be required.
\def\make@df@tag@@#1{%
\gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}}}
Autogenerated number:
\def\make@df@tag@@@#1{\gdef\df@tag{\tagform@{#1}%
\toks@\@xp{\p@equation{#1}}\edef\@currentlabel{\the\toks@}}}
The crucial part of the above discussion is the mention that within a display, amsmath takes control of the \label and \tag, deferring the former until the tag has been set. It allows for ease-of-use from a user's perspective*.
So you will either have to tap into the setting of the tag in order to extract the correct \@currentlabel, or you'll have to stick to using a \label-\ref system. refcount is another option for extracting the reference in an expandable way, still using a \label-\ref-like setup:

\documentclass{article}
\usepackage{amsmath,refcount}
\begin{document}
\begin{equation}
A = B \label{firstone}
\end{equation}
Now
\begin{align}
C &= D \label{secondone} \\
C' &= D' \label{thirdone}
\end{align}
\begin{equation}
E = F \label{fourthone}
\end{equation}
The counters are \getrefnumber{firstone}, \getrefnumber{secondone}, \getrefnumber{thirdone}, \getrefnumber{fourthone}.
\end{document}
*In an analogous (yet opposite) way there's no control over the placement of the \caption inside a float - it's set inline with the placement. As such, the user has to make sure that \label comes after the \caption; amsmath tries to accommodate the user by allowing them to place \label wherever inside the display - before or after the \tag even without a \tag.
\labeland\ref? – Henri Menke Jul 12 '16 at 21:51\storelabelcommand is executed before the equation number is set, i.e.\@currentlabelis just empty! The reason it works forequationis that\inc@eqnumis used right at the begin of the environment, not in the\toks@token register at the very end – Jul 12 '16 at 22:40\ref{label}, as far as I know, is not "just" the counter value.\typeout{\ref{equation1}}yields something like1\hbox {}. If you have an idea how I can just use\refto get only the reference number that I can stuff into an auxiliary file, I'd also welcome that solution. (I don't mind having to runpdflatexmultiple times.) – Willie Wong Jul 12 '16 at 23:13\getrefnumbercommand fromrefcountpackage -- that is expandable,\refisn't – Jul 12 '16 at 23:21