$$
\left(\frac{\mathrm d}{\mathrm dt}\left[\left(\frac{\partial q}{\partial\dot{x}}\right)\frac{\partial}{\partial q}+\left(\frac{\partial\dot{q}}{\partial\dot{x}}\right)\frac{\partial}{\partial\dot{q}}\right]-\left[\left(\frac{\partial q}{\partial x}\right)\frac{\partial}{\partial q}+\left(\frac{\partial\dot{q}}{\partial x}\right)\frac{\partial}{\partial\dot{q}}\right]\right)L\left(q,\dot{q},t\right)=0
$$
Dear Mikael, if you had carried your derivation a little bit further, you would have gotten the correct answer!
First notice that since you wrote: $q = q(x,t)$, $q$ is not explicitly dependent on $\dot x$. So:
$$ \frac{\partial q}{\partial \dot x} = 0$$
In addition, as you wrote: $$ \dot q = \frac{\partial q}{\partial t} + \frac{\partial q}{\partial x}\dot x$$ Which means that:
$$ \frac{\partial \dot q}{\partial \dot x} = \frac{\partial q}{\partial x} \quad \text{simply reading from the expression of $\dot q$}$$
So we can simplify your original expression down to:
$$\left( \frac{\mathrm d}{\mathrm dt}\left(\frac{\partial q}{\partial x}\frac{\partial}{\partial \dot q}\right) - \frac{\partial q}{\partial x}\frac{\partial}{\partial q} - \frac{\partial \dot q}{\partial x}\frac{\partial}{\partial \dot q} \right) L(q,\dot q,t) = 0$$
In order to make this resemble EL equations more, we apply chain rule and do some rearrangements of terms:
$$\left( \frac{\mathrm d}{\mathrm dt}\frac{\partial q}{\partial x} \cdot\frac{\partial}{\partial \dot q} - \frac{\partial \dot q}{\partial x}\frac{\partial}{\partial \dot q}+ \frac{\partial q}{\partial x} \cdot \frac{\mathrm d}{\mathrm dt}\frac{\partial}{\partial \dot q} - \frac{\partial q}{\partial x}\frac{\partial}{\partial q} \right) L(q,\dot q,t) = 0$$
Notice that the first two terms actually cancel because:
$$ \frac{\partial \dot q}{\partial x} = \frac{\partial}{\partial x}\frac{\mathrm d}{\mathrm dt} q = \frac{\mathrm d}{\mathrm dt} \frac{\partial}{\partial x} q $$
So now we are only left with:
$$\left( \frac{\partial q}{\partial x} \cdot \frac{\mathrm d}{\mathrm dt}\frac{\partial}{\partial \dot q} - \frac{\partial q}{\partial x}\frac{\partial}{\partial q} \right) L(q,\dot q,t) = 0$$
But that just means:
$$\frac{\partial q}{\partial x} \cdot \left( \frac{\mathrm d}{\mathrm dt}\frac{\partial}{\partial \dot q} - \frac{\partial}{\partial q} \right) L(q,\dot q,t) = 0$$
Since the coordinate transformation is not singular, $\frac{\partial q}{\partial x} \neq 0$, which implies that:
$$ \left( \frac{\mathrm d}{\mathrm dt}\frac{\partial}{\partial \dot q} - \frac{\partial}{\partial q} \right) L(q,\dot q,t) = 0$$
P.S. The same derivation would fail if $q$ is dependent upon $\dot x$. See Qmechanic 's answer in the question you quoted.
Best Answer
I) The Euler-Lagrange (EL) equations behave covariantly under reparametrizations$^1$ of the form
$$ \tag{1} q^{\prime i}=f^i(q,t),$$
i.e. it is equivalent to reparametrize before or after forming the EL equations.
II) The above property even holds for a Lagrangian $L(q,\dot{q},\ddot{q},\ldots, \frac{d^Nq}{dt^N};t)$ that depends on higher-order time-derivatives, although a higher-order version of Euler-Lagrange equations with higher-order derivatives is needed in such case.
III) However, for a velocity-dependent reparametrization $q^{\prime }=f(q,\dot q,t)$, which OP mentions in his second line (v2), the substitution before or after in general leads to EL eqs. of different orders. We expect that the higher-order EL eqs. to always factorize via the corresponding lower-order EL eqs., so that solutions to the lower-order EL eqs. are also solutions to the higher-order EL eqs. but not vice-versa.
Similarly for acceleration-dependent reparametrizations, etc.
IV) Example: Consider the velocity-dependent reparametrization
$$\tag{2} q^{\prime}~=~q+A \dot{q}, \qquad A>0,$$
of the Lagrangian$^2$
$$\tag{3} L^{\prime}~=~ \frac{1}{2} q^{\prime 2}~=~\frac{1}{2}(q+A \dot{q})^2~\sim~ \frac{1}{2}q^2 +\frac{A^2}{2} \dot{q}^2. $$
(We call $q^{\prime}$ and $q$ the old and new variables, respectively.) Before, the EL equation is of first order in the new variables$^3$
$$\tag{4} 0\approx q^{\prime}~=~q+A \dot{q},$$
with only exponentially decaying solutions. After the reparametrization, the EL equation is of second order
$$\tag{5} 0\approx q- A^2 \ddot{q}~=~(1-A\frac{d}{dt})(q+A \dot{q}),$$
so that it has more solutions. Note however that eq. (5) factorize via (=can be obtained from) eq. (4) by applying a differential operator $1-A\frac{d}{dt}$.
--
$^1$ There are various standard regularity conditions on a reparametrization (1) such as e.g. invertibility and sufficiently differentiability. The higher jets (velocity, acceleration, jerk, etc) are implicitly assumed to transform in the natural way.
$^2$ The $\sim$ sign means here equal modulo total derivative terms.
$^3$ The $\approx$ sign means here equal modulo the EL equations.