How is the formula of mean activity coefficient derived?
The problem is you were starting with an expression for the mean activity coefficient for salts where both the cation and anion were monovalent, and then attempting to derive, from this, a general expression for salts of all empirical formulas. To correct this, you need to start with the general expression for the mean activity coefficient of salts of any emprical formula.
If the empirical formula of the salt is of the form $\ce{A_pB_q}$, where A is the cation and B is the anion, then the general formula for the mean activity coefficient is:
$$\gamma_{\pm} = \sqrt[^{p+q}]{\gamma^p_+\gamma^q_-}$$
[Adapted from: https://en.wikipedia.org/wiki/Activity_coefficient, where I've taken the Wikipedia expression and substituted $\gamma_+$ for $\gamma_A$, and $\gamma_-$ for $\gamma_B$, to correspond to the nomenclature you are using.]
Charge balance dictates that  $|z_+| = q$ and $|z_-| = p$. [E.g., in $\ce{A_2B_3}$, the charge on A must be 3+, and that on B must be 2- (or some integer multiple of those).]
Substituting, we have:
$$\gamma_{\pm} = \sqrt[^{|z_-|+|z_+|}]{\gamma^{|z_-|}_+\gamma^{|z_+|}_-}$$
If you use that in place of eqn. (3-37) in your post, and work through your calculations again, you will get the result show in eqn. (3-38), which is a general result for any values of p and q.