If we have a function $f(x,v)$, the partial derivatives are defined by $$\frac{\partial f(x,v)}{\partial x} \equiv \lim_{h\to 0} \frac{f(x+h,v)-f(x,v)}{h}$$ and $$\frac{\partial f(x,v)}{\partial v} \equiv \lim_{h\to 0} \frac{f(x,v+h)-f(x,v)}{h}$$ This implies, for example, for $f=v^2$ that $$\frac{\partial v^2}{\partial x} \equiv \lim_{h\to 0} \frac{v^2-v^2}{h} =0.$$ Moreover, for $v= \frac{dx}{dt}$ we find that $x \to x+h$ implies $v = \frac{dx}{dt} \to v' = \frac{d(x+h)}{dt} = \frac{dx}{dt} =v$. Thus $$\frac{\partial \frac{dx}{dt}^2}{\partial x} \equiv \lim_{h\to 0} \frac{\frac{dx}{dt}^2-\frac{dx}{dt}^2}{h} =0.$$ Hence it makes sense to consider the partial derivatives of the Lagrangian with respect to $x$ and $v$ separately and in this sense treat them independently. --- In more physical terms, recall that our goal in the Lagrangian formalism is to figure out the correct path in configuration space between two fixed location. A path is characterized by a location and velocity at each point in time. We are as general as possible and consider really all possible paths. This implies that we consider all possible pairings of locations and velocities. The physical classical path is special for two reasons: - it's a solution of the Euler-Lagrange equation (= extremum of the action) - the locations and velocities at each moment in time are related by $v \equiv \frac{dq}{dt}$. (If you want, $v \equiv \frac{dq}{dt}$ is the second equation that we need in the Lagrangian formalism analogous to how there are two Hamilton equations in the Hamiltonian formalism. The second Hamilton equation defines the canonical momentum as a derivative of the Lagrangian. For general paths in phase space, any pairing of location and momentum is possible. Only for the physical classical path we find canonical momentum values that are given as the appropriate derivative of the Lagrangian.)