Expected value of dice game -- Can Wald's equality be used? This is somewhat related to Expected payoff of dice game, where the problem is:

You roll a fair $6$-sided die. For each roll, you're paid the face value. The game stops when you roll a $1,2,3$. If you roll a $4,5,6$, you can roll again and keep accumulating payments.


Mees's comments states that Wald's equality can not be used to solve this problem because $N$ is not independent of $X_i$, although I don't believe that dependency precludes us from using Wald's equality. But there is something else that concerns me about the application of Wald's equality here.
For all variants of Wald's equality, the $X_i$'s are always IID. For the dice game, I am hesitant to believe they are IID.
The thing is, the game stops if we roll a $1,2,3$. So if we make it to round 2, then that, by definition, means that we tossed a $4,5,6$ in round 1. So based on this, it seems we lose independency and identicalness, and the $X_i$'s are no longer independent nor identical?
In the book where I saw this question from, it states

Wald's equality can be applied since the problem has clear stopping rules. For each roll, the process has 0.5 probability of stopping. So the stopping time $N$ follows a geometric distribution with $p = 0.5$, and thus $E[N] = 2$. For each toll, the expected face value is $E[X] = 3.5$. The total expected payoff is $E[S_N] = E[X]E[N] = 7$ where $S_N = X_1 + \ldots + X_N$.

But I am hesitant to believe this is valid. I don't believe the $X_i$'s are independent for the reason I stated above. Furthermore, we know that $X_1, \ldots, X_{N-1}$ must be $\in \{4,5,6\}$ otherwise the game would have stopped, and we further know $X_N \in \{1,2,3\}$.
So I think the more appropriate justification would actually be that we can view $Y_1, \ldots, Y_{N-1}$ as IID of a 3-sided dice with faces $4,5,6$, and redefine $S_N = Y_1 + \ldots + Y_{N - 1} + X_N$.
Then I want to apply Wald's equality to $E[Y_1 + \ldots + Y_{N - 1}]$, but now I am unsure if Wald's equality's assumptions are satisfied. If they are, this would give us $E[Y_1]E[N - 1] = 5 * 1 = 5$..
And then we have $E[X_N] = 2$.
So the expected payoff is $E[S_N] = 5 + 2 = 7$. I don't know if my approach is more valid, or if the book's approach is valid.
Overall, I'm quite confused.
 A: If $X_k$ is the $k$-th roll of the dice then all $X_k$ are independent, just note that what happen in a roll doesn't determine what happen in another. You are mixing there the end of the game, what can be seen as a stopping time, and the $X_k$, what are just i.i.d. r.v.
Indeed $\{N=n\}=\{(X_1,\ldots ,X_{n-1})\in A^{n-1}, X_n\in B\}$, for $A:=\{4,5,6\}$ and $B:=\{1,2,3\}$, so $\{N=n\}\in \mathcal{F}_n:=\sigma (X_1,\ldots ,X_n)$ and consequently $N$ is a stopping time by definition. Then a version of Wald's identity can be applied, this version says that if $N$ is a finite stopping time and all $X_k$ are i.i.d. non-negative r.v. with finite mean $m$, then $\operatorname{E}[S_N]=m\operatorname{E}[N]$ where
$$
S_N:=\sum_{k=1}^N X_k
$$
Now suppose that $N=\infty $, this would mean that the game never stop, however the probability of this is zero, so $N$ is a finite stopping time and you can apply the previous version of Wald's identity.
Note: this Wald's identity appear in a problem of the book of Robert Ash of probability and measure.

EDIT:  an alternative approach, surely more intuitive, is to use the law of total expectation, that is
$$
\begin{align*}
\operatorname{E}[S_N]&=\sum_{n\geqslant 1}\operatorname{E}[S_N|N=n]\Pr [N=n]\\
&=\sum_{n\geqslant 1}\operatorname{E}[S_n|N=n]\Pr [N=n]\\
&=\sum_{n\geqslant 1}\sum_{k=1}^n\operatorname{E}[X_k|N=n]\Pr [N=n]\\
&=\sum_{n\geqslant 1}(5(n-1)+2)\Pr [N=n]\\
&=\sum_{n\geqslant 1}(5(n-1)+2)\left(\frac1{2}\right)^n\\
&=5\sum_{n\geqslant 1}n2^{-n}-3\\
&=5\cdot 2-3\\
&=7
\end{align*}
$$
because
$$
\operatorname{E}[X_k|N=n]=\begin{cases}
5,&\text{ if }k<n\\
2,&\text{ if }k=n\\
0,&\text{ otherwise }
\end{cases}
$$
