Second step: given $\epsilon>0,$ we can construct a diffeo $\phi$ from $\mathrm{int}(\mathbb D^n)$ to a subset of the points $x$ with $\mathrm{rank}(df_x)\geq n-1,$ such that $\|d\phi\|= O(1/\epsilon),$$\max_x|d\phi_x|= O(1/\epsilon),$ and the set where $\phi(x)\neq x$ has measure $O(\epsilon^3).$ The implicit constants here are allowed to depend on $f.$
Let $\epsilon>0.$ Define $$R_0=\min_{x\in E}|x|.$$ Define $E'$ to be the set of points $v\in S^{n-1}$ such that $\lambda v\in E$ for some $0\leq \lambda < 1$ - the radial projection of $E$ to the boundary of the disc. I will argue that the $\epsilon$-neighborhood of $E'$ in $S^{n-1}$ (the set of points at distance at most $\epsilon$ from $E'$) has $(n-1)$-dimensional volume at most $O(\epsilon^3).$ The homeomorphism $\phi:(v,r)\mapsto rv$ from $S^{n-1}\times (R_0/2,2)$$S^{n-1}\times (R_0/2,1)$ to $\{x\in D^n\mid |x|\in(R_0/2,2)\}$$\{x\in D^n\mid |x|\in(R_0/2,1)\}$ is a diffeo. So the preimage of the the at-most-$(n-4)$-dimensional manifold $E$ still has Minkowski dimension $n-4.$ It can therefore be covered by a set of $N(\epsilon)$ balls $B((v_i,r_i),\epsilon)$ such that $N(\epsilon) \epsilon^{n-4}=O(1).$ The projected balls $B(v_i,\epsilon)\subset S^{n-1}$ cover $E'$ and still satisfy $N(\epsilon) \epsilon^{n-4}=O(1).$ This means the $(n-1)$-dimensional volume is at most $N(\epsilon) \epsilon^{n-1}=O(\epsilon^3).$$O(1)N(\epsilon) \epsilon^{n-1}=O(\epsilon^3).$ Doubling the radii gives a set $\bigcup_i B(v_i,2\epsilon)$ still of $(n-1)$-dimensional volume $O(\epsilon^3),$ and containing the $\epsilon$-neighborhood of $E'.$
- $h$ is smooth
- $h(v)\leq R_0/2$$h\leq R_0/2$ on $E'$
- $h(v)> 1$$h\geq 1$ except on the $\epsilon$-neighborhood of $E'$
- $h$ has Lipschitz constant $O(1/\epsilon)$
However $g$ may not be smooth. To deal with this, we can think of $S^{n-1}$ as the symmetric space $SO(n)/SO(n-1),$ so $g$ is a function on $SO(n)$ invariant under the right action of $SO(n-1)$ (specifically, $SO(n-1)$ is the stabilizer of $(1,0,0,\dots,0),$ and a rotation $\rho\in SO(n)$ corresponds to the point $\rho\cdot (1,0,0,\dots,0)\in S^{n-1}$). Convolve by left multiplication by a smooth mollifier $SO(n)\to\mathbb R$ supported on a small ball around the identity. The resulting function is still invariant under the right $SO(n-1)$ action, so corresponds to a function $h:S^{n-1}\to [0,1].$$h:S^{n-1}\to [R_0/4,2].$ This function $h$ will be smooth (basically by the implicit function theorem). It is a convex combination of rotated versions of $g,$ where each rotation moves points by no more than $R_0\epsilon/8$ say. This ensures conditions (2.) and (3.), and also (4.) because the set of functions with Lipschitz constant $\leq 2/\epsilon$ is convex.
Let $\psi:\mathbb R\to\mathbb R$ be a smooth function with $\psi(x)=x$ for $x\leq 0,$ and $\psi(x)<R_0/2$ and $0<\psi'(x)\leq 1$ everywhere. Define $\phi:\mathrm{int}(\mathbb D^n)\to \mathrm{int}(\mathbb D^n)$ by $\phi(0)=0$ and $$\phi(rv)=(\psi(r-h(v))+h(v))v$$ for unit vectors $v$ and real $0<r<1.$ Then $\phi(rv)=rv$ if $r<h(v),$$r\leq h(v),$ in particular for $r<R_0/4$$r\leq R_0/4$ or $h(v)\geq 1.$ So $\phi(x)=x$ in a neighborhood of zero, which ensures $\phi$ is smooth at zero. And $\phi(rv)=rv$ for all $0<r<1$ and $v\not\in E'$; since $E'$ has $(n-1)$-dimensional measure $O(\epsilon^3),$ the set of $x$ of the form $rv$ with $v\not\in E'$ has $n$-dimensional measure $O(\epsilon^3).$ (The probability that a uniformly chosen $x\in D^n$ satisfies $x/|x|\in E'$ is the same as the probability that a uniformly chosen $v\in S^{n-1}$ lies in $E'.$)
The Lipschitz constant of $\phi$ can be bounded by bounding the derivatives of $\phi$ along a path through $(r,v)$ with $r>R_0/4$ and $|\dot r|,|\dot v|\leq 1.$ Writing $h=h(v)$ and $\psi=\psi(r-h),$ the chain rule gives $|\dot h|=O(1/\epsilon)$ and hence $|\dot\psi|=O(1/\epsilon).$ So $$\frac{d}{dt} \phi(rv) = (\dot\psi+\dot h)v + (\psi+h)\dot v = O(1/\epsilon)$$ which means $\|d\phi\|=O(1/\epsilon).$$\max_x|d\phi_x|=O(1/\epsilon).$ $\square$
The integral of $|d(f\circ \phi)-df|^2$ is at most the maximum value of the integrand, $O(1/\epsilon^2),$ multiplied by the volume of the set where the integrand can be non-zero, $O(\epsilon^3),$ giving $O(1/\epsilon^2)$$O(\epsilon)$ overall. The integral of $|(f\circ \phi)-f|^2$ is even better: $O(\epsilon^3).$ So $\|f-f\circ \phi\|^2_{W^{1,2}}=O(\epsilon).$ And the rank of $f\circ \phi$ will be $\geq n-1$ everywhere.