I am still working through Pugh's Real Analysis book. While pretending to do grammar exercises in English, I think I solved this problem (but it's different from what I've found online, so I'm suspicious if/where I've made a mistake)
Problem: Assume that $\varphi:[a,b] \rightarrow \mathbb{R}$ is continuously differentiable. Let $S = \{ y\in\mathbb{R}: \exists x \in [a,b] \text{ such that } y =\varphi(x), 0 = \varphi'(x)\}$. We prove $S$ is a zero set.
Note because any finite set has total length zero it suffices to prove $S$ is finite. For each $y \in C$, choose an open interval $I=(x-h_1, x+h_2)$ such that $\varphi(x) = y$, $\varphi'(x)=0$, and $\nexists x' \in I$ with $\varphi'(x') = 0$ and $\varphi(x') \neq \varphi(x)$. We can take $h_1 = \frac{3}{4} \sup \{h_1 \leq 0 : \varphi(x+h_1) \neq \varphi(x), \varphi'(x+h_1)=0\}$, and $h_2 = \frac{3}{4} \inf \{h_2 : \varphi(x+h_2) \neq \varphi(x), \varphi'(x+h_2) = 0\}$. These intervals form an open cover of $[a,b]$. Also, $[a,b]$ is covering compact, so we can take a finite subcover $\{I_1, \dots, I_n\}$ such that $[a,b] \subset \bigcup_{i=1}^{\infty} I_i$. Each open interval contains exactly one critical value, and furthermore, because the $I_i$ form a covering, there is a bijection from $C$ to $\{I_1, \dots, I_n\}$. In particular, $C$ is finite and is thus a zero set. $\square$
The set $S$ does not have to be finite though.
Consider the interval $[-1,1]$, and let $\varphi(x) = x^3 \sin(1/x)$. Then $\varphi'(x) = 3x^2 \sin(1/x) - x \cos(1/x)$ extends continuously to $[-1,1]$ and hence $\varphi$ is continuously differentiable.
It is not too hard to see that the corresponding $S$ is countably infinite.
In your construction, I don't see how you can claim that $h_1$ and $h_2$ are not zero (in fact, for $x = 0$, the corresponding $h_1$ and $h_2$ per your construction vanishes for the function I gave above.
Here's one proof of the desired result.
Let $C_{\delta} = \{x: |\varphi'(x)| < \delta\}$. Clearly $S \subset f(C_\delta)$.
Since $C_{\delta}$ is an open set, it can be written as a countable union of disjoint open intervals, which we label as $I_{\delta,k}$. Since $I_{\delta,k}$ are disjoint and are all subsets of $[a,b]$, we have that $\sum_{k} |I_{\delta,k}| \leq b-a$.
On the other hand, since $|\varphi'(x)| < \delta$ on $I_{\delta,k}$, we have that $|\varphi(I_{\delta,k})| < \delta |I_{\delta,k}|$. By countable subadditivity we have that $|\varphi(C_{\delta})| < \delta \sum_{k} |I_{\delta,k}| \leq \delta (b-a)$. And hence $|S| \leq \delta(b-a)$. Since $\delta$ is arbitrary we have that $|S| = 0$.