The problem is that the Lagrangian and the Hamiltonian are functions of different variables, so you must be exceedingly careful when comparing their partial derivatives.
Consider the differential changes in $L$ and $H$ as you shift their arguments:
$$dL = \left(\frac{\partial L}{\partial q}\right) dq + \left(\frac{\partial L}{\partial \dot q}\right) d\dot q$$
$$dH = \left(\frac{\partial H}{\partial q}\right) dq + \left( \frac{\partial H}{\partial p}\right) dp$$
Finding $\frac{\partial L}{\partial q}$ corresponds to wiggling $q$ while holding $\dot q$ fixed. On the other hand, finding $\frac{\partial H}{\partial q}$ corresponds to wiggling $q$ while holding $p$ fixed. If $p$ can be expressed a function of $\dot q$ only, then these two situations coincide - however, if it also depends on $q$, then they do not, and the two partial derivatives are referring to two different things.
Explicitly, write $p = p(q,\dot q)$. Then using the chain rule, we find that
$$dH = \left(\frac{\partial H}{\partial q}\right) dq + \left(\frac{\partial H}{\partial p}\right)\left[\frac{\partial p}{\partial q} dq + \frac{\partial p}{\partial \dot q} d\dot q\right]$$
So, if we shift $q$ but hold $\dot q$ fixed, we find that
$$ dL = \left(\frac{\partial L}{\partial q} \right)dq$$
while
$$ dH = \left[\left(\frac{\partial H}{\partial q} \right) + \left(\frac{\partial H}{\partial p}\right)\left(\frac{\partial p}{\partial q} \right)\right]dq$$
If $L(q,\dot q) = H(q,p(q,\dot q))$ as in the case of a free particle, then we would find that
$$dL = dH$$
so
$$\left(\frac{\partial L}{\partial q}\right)= \left(\frac{\partial H}{\partial q} \right) + \left(\frac{\partial H}{\partial p}\right)\left(\frac{\partial p}{\partial q} \right)$$
We can check this for the free particle in polar coordinates, where
$$L = \frac{1}{2}m(\dot r^2 + r^2 \dot \theta^2)$$
$$ H = \frac{p_r^2}{2m} + \frac{p_\theta^2}{2mr^2}$$
$$ p_r = m\dot r \hspace{1 cm} p_\theta = mr^2 \dot \theta$$
for the left hand side,
$$ \frac{\partial L}{\partial r} = mr \dot \theta^2$$
For the right hand side,
$$ \frac{\partial H}{\partial r} = -\frac{p_\theta^2}{mr^3} = -mr\dot\theta^2$$
$$ \frac{\partial H}{\partial p_\theta} = \frac{p_\theta}{mr^2} = \dot \theta$$
$$ \frac{\partial p_\theta}{\partial r} = 2mr\dot \theta$$
so
$$ \frac{\partial H}{\partial r} + \frac{\partial H}{\partial p_\theta} \frac{\partial p_\theta}{\partial r} = -mr\dot \theta^2 + (\dot \theta)(2mr\dot \theta) = mr\dot \theta^2$$
as expected.
Your mistake was subtle but common. In thermodynamics, you will often find quantities written like this:
$$ p = -\left(\frac{\partial U}{\partial V}\right)_{S,N}$$
which means
The pressure $p$ is equal to minus the partial derivative of the internal energy $U$ with respect to the volume $V$, holding the entropy $S$ and particle number $N$ constant
This reminds us precisely what variables are being held constant when we perform our differentiation, so we don't make mistakes.
OP is essentially asking:
Why can't we replace the Lagrangian $L=T-V$ with $L=E-2V$ by using energy conservation $T+V=E$, where $E$ is an integration constant?
Answer: Generically an action principle gets destroyed if we apply EOMs in the action.
Specifically, OP used energy conservation $T+V=E$, which were derived from EOMs. Here it is important to understand that the stationary action principle must be defined for all (sufficiently smooth) paths. Not just the classical trajectories, which satisfy the EOMs.
Note in particular, that the off-shell/virtual paths are not required to obey energy conservation.
Alternatively, it is easy to check that OP's proposed Lagrangian $L=E-2V$ would lead to wrong EOMs.
For examples, see this & this related Phys.SE posts.
Best Answer
If the system is scleronomous and the potential does not depend on generalized velocities, then the hamiltonian equals the energy.
By being scleronomous it means that there is no explicit time dependence in the transformations between Cartesian and generalized coordinates, $\vec r_a=\vec r_a(q_1,\ldots,n)$. In this case, the kinetic energy is written as a quadratic form $$T=\frac12\sum_{i,j}A_{ij}(q)\dot q_i\dot q_j,$$ which is a homogeneous functions of degree two on velocities.
Since the potential does not depend on velocities, then $$\sum_i\dot q_i\frac{\partial L}{\partial\dot q_i}=\sum_i\dot q_i\frac{\partial T}{\partial\dot q_i},$$ and by Euler homogeneous function theorem this equals to $2T$. Therefore, $$H=2T-(T-V)=T+V=E.$$