In Tao's Introduction to Measure Theory, Lusin's theorem is presented and proved as follows: (I've adapted the proof slightly so it stands on its own.)
Theorem. Let $f : \mathbb{R}^d \to \mathbb{C}$ be absolutely integrable, and let $\epsilon > 0$. Then there exists a Lebesgue measurable set $E \subseteq \mathbb{R}^d$ of measure at most $\epsilon$ such that the restriction of $f$ to the complementary set $\mathbb{R}^d \setminus E$ is continuous on that set.
Proof. Since continuous, compactly supported functions are dense in the space of absolutely integrable functions (with respect to the $L_1$ seminorm), for all $n \geq 1$ we can find a continuous, compactly supported function $f_n$ such that $\|f - f_n\|_{L_1} \leq \epsilon/4^n$ By Markov's inequality, this implies that $|f(x) - f_n(x)| \leq \epsilon/2^n$ for all $x$ outside a Lebesgue measurable set $E_n$ of measure at most $\epsilon/2^n$. Letting $E := \bigcup_{n=1}^\infty E_n$, we conclude that $E$ is Lebesgue measurable with measure at most $\epsilon$, and $f_n$ converges uniformly to $f$ outside of $E$. But the uniform limit of continuous functions is continuous. We conclude that the restriction of $f$ to $\mathbb{R}^d \setminus E$ is continuous, as required.
I understand each step of this proof, but I fail to see why it matters that the $f_n$ are compactly supported. I have a hunch that it doesn't actually matter, and is just an artifact of using an earlier theorem with a stronger conclusion than what's needed for this proof. But I'm not positive, since I see on the wikipedia page for Egorov's theorem:
Egorov's theorem can be used along with compactly supported continuous functions to prove Lusin's theorem for integrable functions.
So here too a point is being made about functions having compact support. What role does compact support play in the picture of Egorov and Lusin's theorms?