Relation between chemical kinetics and chemical equilibrium
The derivation that you cite only holds true if both forward and backward reactions are elementary steps. In this case, the rate of the forward reaction is indeed given by

$$r = k[\ce{A}]^a[\ce{B}]^b$$

and so on, and hence the derivation is logically sound. If they are not elementary steps, then even though the conclusion is correct, the method of arriving there is not, for the reasons you have already pointed out. See also: hBy2Py's answer and Ben Norris's answer where the assumption of an elementary step is explicitly mentioned.



In general the equilibrium constant does not need to be derived in this manner; a more conventional method of arriving at it is by using (pressure here is taken to equal an arbitrary but specified standard pressure $p^\circ$)

$$\mu_i = \mu_i^\circ + RT\ln a_i$$

where $\mu_i$ is the chemical potential of species $i$, $\mu_i^\circ$ is the standard chemical potential of species $i$, and $a_i$ is the chemical activity of species $i$. We now have, for a reaction

$$\ce{a A + b B -&gt; c C + d D},$$

the following equation:

$$\begin{align}
\Delta_\mathrm r G^\circ &amp;= c\mu_\ce{C}^\circ + d\mu_\ce{D}^\circ - a\mu_\ce{A}^\circ - b\mu_\ce{B}^\circ \\
&amp;= c(\mu_\ce{C} - RT\ln a_\ce{C}) + d(\mu_\ce{D} - RT\ln a_\ce{D}) - a\mu_\ce{A} - RT\ln a_\ce{A} - b(\mu_\ce{B} - RT\ln a_\ce{B}) \\
&amp;= c\mu_\ce{C} + d\mu_\ce{D} - a\mu_\ce{A} - b\mu_\ce{B} - RT \ln\left[\frac{(a_\ce{C})^c (a_\ce{D})^d}{(a_\ce{A})^a (a_\ce{B})^b}\right] \\
&amp;= \Delta_\mathrm r G - RT \ln\left[\frac{(a_\ce{C})^c (a_\ce{D})^d}{(a_\ce{A})^a (a_\ce{B})^b}\right]
\end{align}$$

However, at equilibrium, $\Delta_\mathrm r G = 0$ and hence

$$\Delta_\mathrm r G^\circ = - RT \ln\left[\frac{(a_\ce{C})^c (a_\ce{D})^d}{(a_\ce{A})^a (a_\ce{B})^b}\right]$$

The term in square brackets can then be identified as the equilibrium constant, $K$. As you can see there is no need for any recourse to kinetic rate laws.

Why is $K$ a constant? Well, the standard chemical potentials $\mu_i^\circ$ are thermodynamic constants, just like standard enthalpies of formation, standard entropies, etc. So $\Delta_\mathrm r G^\circ$ - a sum of constants - is itself a constant, and it follows that $K = \exp(-\Delta_\mathrm r G^\circ/RT)$ must be a constant.