Why is $P(X,Y|Z)=P(Y|X,Z)P(X|Z)$?
From $$ P(X,Y|Z) = \frac{P(X,Y,Z)}{P(Z)}$$ $$ P(Y|X,Z) = \frac{P(X,Y,Z)}{P(X,Z)}$$ $$ P(X|Z) = \frac{P(X,Z)}{P(Z)}$$ we have $$P(Y|X,Z) P(X|Z)=\frac{P(X,Y,Z)}{P(X,Z)}\frac{P(X,Z)}{P(Z)}=\frac{P(X,Y,Z)}{P(Z)}=P(X,Y|Z).$$ This is also intuitive: The probability that $X$ and $Y$ happen if we know that $Z$ happens is the same as the probability that $X$ happens when we know that $Z$ happens and that then $Y$ happens when we know that $X$ and $Z$ happen.
Let's note $\mathbb P_{\mathrm Z}$ the probability $\mathbb P(...|\mathrm Z)$. Then apply your formula : $\mathbb P_{\mathrm Z}(X,Y) = \mathbb P_{\mathrm Z}(X | Y) \mathbb P_{\mathrm Z}(Y)$.
Now $\mathbb P_{\mathrm Z}(X |Y) = \mathbb P_{\mathrm {Z, Y}}(X)$ because both are equal to $\frac{\mathbb P_{\mathrm Z}(X,Y)}{\mathbb P_{\mathrm Z}(Y)} = \frac{\mathbb P(X,Y,Z)}{\mathbb P(Y,Z)}$.