Application of Weierstrass Approximation theorem to derivatives

I am struggling to understand the application of Weierstrass Approximation theorem (WAT):

Let $f \in C^1$ be a function defined on $[-K,K]$. The book claims that for each $n$, there exists a polynomial $p_n$ such that the $C^1$ function $g_n = f-p_n$ satisfies the bound $$\sup_{x \in [-K,K]} \big[ |g_n(x)| + |g_n'(x)| \big] < \frac{1}{n}.$$

The problem is that the polynomial $q_n$ obtained by applying WAT to $g_n'$ is not necessarily the derivative of the polynomial $p_n$ obtained by applying WAT to $g_n$.

Apply WAT to $f'$ to get a polynomial $q_n$ with $|f'(x)-q_n(x)|< \frac1{2nK}$. Let $p_n$ be an antiderivative of $q_n$ with $p_n(0)=f(0)$. Then, setting $g_n=f-p_n$, we have $$|g_n'(x)| = |f'(x)-p_n'(x)|=|f'(x)-q_n(x)|< \frac1{2nK},$$ and \begin{align*} |g_n(x)| &\leq |f(x)-p_n(x)| \\ &= \left|\int_0^x (f'(t)-p_n'(t))\ dt\right|\\ &\leq \left|\int_0^x |f'(t)-p_n'(t)|\ dt\right|\\ &\leq \left|x\cdot \frac1{2nK}\right| \\ &\leq K\cdot \frac1{2nK} = \frac1{2n}. \end{align*} Therefore, $$|g_n(x)|+|g_n'(x)| < \frac1{2nK}+\frac1{2n} <\frac1n$$