Suppose I have a function $f = xy$. A partial derivative of $f$ with respect to $x$ implies holding $y$ constant:
$$ \frac{\partial f}{\partial x} = y $$
Does this mean that in order to evaluate this derivative, $y$ cannot depend on $x$? For example, if $y = x$ then
$$ \frac{\partial f}{\partial x} = \frac{\partial (x^2)}{\partial x} = 2x $$
Which is inconsistent with the first calculation of $\frac{\partial f}{\partial x}$.
If $y$ indeed cannot depend on $x$, then how does the Lagrangian formalism of classical mechanics make sense? The Lagrangian is a function of $q$ and $\dot{q}$, and when we evaluate $\frac{\partial L}{\partial \dot{q}}$ we 'ignore' all of the $q$ dependence, even though $\dot{q}$ is a function of $q$.