Eliminating all removable discontinuities

Let's use this definition of a removable singularity (from StinkingBishop's answer):

$f$ has a removable discontinuity at $a$ iff $\lim_{x \to a}f(x)$ exists but $\lim_{x \to a}f(x) \neq f(a)$.

Since all of the discontinuities of $f$ are removable, $\lim_{x \to a} f(x)$ exists for all $a \in \mathbb R$.

(If $f$ is continuous at $a$, then $\lim_{x \to a}f(x)$ exists and $\lim_{x \to a}f(x) = f(a)$. If $f$ has a removable discontinuity at $a$, then $\lim_{x \to a}f(x)$ exists but $\lim_{x \to a}f(x) \neq f(a)$.)

This means that it makes sense to define a function $g(x) := \lim_{y \to x} f(y)$.

Claim: For all $a \in \mathbb R$, $\lim_{x \to a} g(x) = g(a)$. (This proves that $g$ is continuous everywhere.)

Proof: Fix an $a \in \mathbb R$. Fix an $\epsilon > 0$. Since $\lim_{x \to a} f(x) = g(a)$, there exists a $\delta > 0$ such that $$x \in (a - \delta, a) \cup (a, a + \delta) \implies f(x) \in \left( g(a) - \tfrac 1 2 \epsilon, g(a) + \tfrac 1 2 \epsilon \right) \subset \left[ g(a) - \tfrac 1 2 \epsilon, g(a) + \tfrac 1 2 \epsilon \right].$$

But then, $$x \in (a - \delta, a) \cup (a, a + \delta) \implies g(x) = \lim_{y \to x} f(y) \in \left[ g(a) - \tfrac 1 2 \epsilon, g(a) + \tfrac 1 2 \epsilon \right] \subset \left( g(a) - \epsilon, g(a) + \epsilon \right).$$

[To spell this out, if $x \in (a - \delta, a) \cup (a, a + \delta)$, then there exists an open neighbourhood $U$ of $x$ such that $f(y) \in \left[ g(a) - \tfrac 1 2 \epsilon, g(a) + \tfrac 1 2 \epsilon \right]$ for all $y \in U$. Hence $\lim_{y \to x} f(y) \in \left[ g(a) - \tfrac 1 2 \epsilon, g(a) + \tfrac 1 2 \epsilon \right]$.]

This shows that $\lim_{x \to a} g(x) = g(a)$.