Deriving the equation for reaction spontaneity
The method you described for deriving the desired relationship is one of two that I am aware of.  In my judgment, it is important to mention that this approach looks at a reaction in progress,  determining the free energy of the mixture of reactants and products as a function of the reaction conversion.  As such, it makes the tacit assumption that it is valid for this irreversible process of a reaction occurring spontaneously to determine the free energy at each conversion as if one is considering a thermodynamic equilibrium state of an unreacting mixture.  In my judgment, this is an excellent approximation, but some purists might argue that such an approach is not valid.

The other approach I am aware of is illustrated for the case of a reaction involving an ideal gas reaction.  It evaluates the change in Gibbs free energy between the following pair of initial and final thermodynamic equilibrium states:


Stoichiometric proportions of pure reactants in separate  containers at temperature T and 1 bar pressure
Corresponding stoichiometric proportions of pure products in separate containers at temperature T and 1 bar pressure


The process for evaluating the change from state 1 to state 2 is reversible, and involves successive steps involving isothermal gas expansions and compressions within cylinders in series with a van't Hopf equilibrium box.  The net result is the standard free energy change of the reaction $\Delta G^0$.

If one then modifies the process slightly, by starting with pure gases in separate containers at pressures different from 1 bar, this merely changes the compression and expansion steps in the reversible process, and results in the value of the Gibbs free energy change altering from $\Delta G^0$ to $$\Delta G=\Delta G^0+RT\ln{Q}$$Moreover, if the initial and final pressures in the separate containers are chosen to exactly match the equilibrium partial pressure of the various species in the equilibrium box, then the compression and expansion steps are not necessary, and the $\Delta G$ for this process is zero.  Under these circumstances the reaction parameter Q is equal to the equilibrium constant:  $$0=\Delta G^0+RT\ln{K}$$