I've recently come across a strange result when comparing the Hamiltonian and Lagrangian formulations of classical mechanics.
Suppose we are working in the regime where we can say the Hamiltonian $H$ is equal to the total energy $$H=T+V.\tag{1}$$ That is, the constraints are holonomic and time-independent, and the potential is $V=V(q)$ where $q$ a the generalized position vector $q=(q_1,q_2,\ldots,q_n)$. Let $$L=T-V\tag{2}$$ be the Lagrangian.
Now, the Euler-Lagrange equations tell us $$\frac{d}{dt}\frac{\partial L}{\partial \dot{q_\sigma}} - \frac{\partial L}{\partial q_\sigma} = 0,\tag{3}$$ for the generalized coordinate $q_\sigma,$ with $\sigma\in\{1,\ldots,n\}$.
We also know that the conjugate momenta are defined by $p_\sigma = \frac{\partial L}{\partial \dot{q_\sigma}}$. So this equation tells us $$\dot{p_\sigma} - \frac{\partial L}{\partial q_\sigma} = 0.\tag{4}$$
In the Hamiltonian formalism, we know that $$\dot{p_\sigma} = -\frac{\partial H}{\partial q_\sigma}.\tag{5}$$
Combining these gives $$\frac{\partial H}{\partial q_\sigma}=-\frac{\partial L}{\partial q_\sigma}.\tag{6}$$
Now, this seems very strange because in the regime we are considering, this implies that $$\frac{\partial (T+V)}{\partial q_\sigma}=-\frac{\partial (T-V)}{\partial q_\sigma}\Rightarrow \frac{\partial T}{\partial q_\sigma}=0. \tag{7}$$
Of course, there are many examples where this is not true. I.e., simply consider the free particle analyzed using polar coordinates. Then we have $$H = L = T = \frac{1}{2}m(\dot{r}^2 + r^2\dot{\theta}^2),\tag{8}$$ and so $$\frac{\partial T}{\partial r } \neq 0.\tag{9}$$
What is the explanation for this strange discrepancy? Am I making a silly mistake somewhere?