Distinguishability given black box access to the distribution
You can't.  Your intuition is wrong.  I will give an explicit counter-example.  Actually, I'll give you two: two for the price of one.
Suppose $n=1$, the distribution $D$ always outputs 1, and $U$ is uniform on $\{0,1\}$.  The following algorithm is an optimal distinguisher:

Never use the black box.  If the input $z$ is 0, guess that it came from $U$, otherwise guess that $z$ came from $D$.

Suppose we run this algorithm on an input $z$ and it guesses that $z$ came from $D$.   Then it's not true that $z$ must be equal to one of the queries to the black box; the algorithm didn't make any queries to the black box.
If you're not happy with that, you can obtain another explicit counterexample by considering the following algorithm, with $U$ being the uniform distribution and $D$ a distribution that outputs $1$ with probability $3/4$ and $0$ with probability $1/4$:

If the input $z$ is 0, get a sample $z_1$ from the black box, ignore $z_1$, and guess that $z$ came from $U$.
Otherwise, get a sample $z_1$ from the black box, ignore $z_1$, and guess that $z$ came from $D$.

Notice that if this algorithm guesses that $z$ came from $D$, it is not necessarily true that $z=z_1$ (it can happen that $z=1$ but $z_1=0$), so your claim is not true about this algorithm either; yet this algorithm is an optimal distinguisher.
It's often useful to test your intuition on some simple examples.
I suspect what you're missing is that the adversary is assumed to know the distributions $D,U$ in advance and then choose an algorithm based on knowledge of $D,U$ -- a different distinguisher algorithm for each different $D$.  There's no requirement to choose a single algorithm that works for all $D,U$.