Your deduction $$P(x,y) = P(x|y) P(y)\implies P(a,z|b) = P(a|(z|b)) P(z|b) = P((a|z)|b)) P(z|b)$$
is wrong. Actually, the expression $P(a\mid (z\mid b))$ does not make sense ($z \mid b$ is neither an event nor a random variable)
The natural way is, seeing that in the target equation everything is conditioned on $b$, start from the "unconditioned" variables $$P(a,z) = P(a \mid z) P(z) \tag{1}$$ and then condition everything on the third variable $b$, which leads us to
$$P(a,z\mid b) = P(a \mid z,b) P(z \mid b) \tag{2}$$
Alternatively, (but I encourage you to get familiar with the procedure above, it's quite frequent and practical) you can write out all the definitions:
$$P(a,z\mid b)=\frac{P(a,z,b)}{P(b)}$$
$$P(a,\mid z,b)=\frac{P(a,z,b)}{P(z,b)}$$
$$P(z\mid b)=\frac{P(z,b)}{P(b)}$$
Putting all together, you get $(2)$