While it is true that the function q-dot(t) is the derivative of the function q(t) w.r.t. time, it is not true that the value q-dot is at all related to the value q at a given point in time, since a value is just a number, not a function. The action is a functional of q(t), and so it would make no sense to vary the action both w.r.t. q and q-dot. But the Lagrangian L(q,q-dot) is a function of the values q and q-dot, not a functional of the functions q(t) and q-dot(t). We can promote L to a function of time if we plug in q(t) and q-dot(t) instead of just q and q-dot. (Remember a functional turns a function into a number, e.g., S[q], whereas a function turns a value into a number, e.g., L(q,q-dot). To solve for q(t) we extremize the action S, by demanding that it is extremal at every point, t. This is equivalent to solving the Euler Lagrange equations at every point t. Since at any point t the values q and q-dot are independent, they can be varied independently.