Just an expansion of the argument:
- if there is an open neighbourhood of x0 where q is constant, we are done as the derivative is 0 by definition
- if there doesn't exist any open neighbourhood around x0 where q would be constant, then for every natural number n, the neighbourhood (x0 - 1/n, x0 + 1/n) features a term xn, such that g(xn) != g(x0). Our sequence can be then taken to be (x1, x2, x3, x4, ...)
Because we assumed the differentiability of p(q(x)), the limit of any ONE sequence defines its whole derivative.
So, us having found that sequence and proved it is the same as the formula for the chain rule is good enough.