How to show a space is not a covering space?

I found that it is intuitively clear, but a rigorous proof is not easy. Here is my attempt. Perhaps it can be shortened, but I do not see that.

Let $p : X \to Y$ be a covering map which is not a homeomorphism. Since $X$ is path-connected, so is $Y$ and all fibers $p^{-1}(y)$ have the same cardinality. This cardinality cannot be $1$ because $1$-sheeted covering maps are homeomorphisms. We claim that $p$ is a $2$-sheeted covering map.

Let us first verify that $p^{-1}(p(a)) \subset \{ a, b\}$ and thus $p^{-1}(p(a)) = \{ a, b\}$ because fibers have more than one point. Hence all fibers have $2$ elements.

Assume that there exists $x \notin \{ a, b\}$ such that $p(x) = p(a)$. Take an open neighborhood $V$ of $p(a)$ which is evenly covered. Hence $p^{-1}(V)$ is the disjoint union of open subsets $U_\iota \subset X$ such that the restrictions $p_\iota : U_\iota \to V$ are homeomorphisms. Let $x \in U_{\iota_x}, a \in U_{\iota_a}$. Let $U$ be an open neighborhood of $x$ which is contained in $U_{\iota_x}$ and homeomorphic to an open interval. Then $U' = p_{\iota_a}^{-1}(p_{\iota_x}(U)$ is an open neighborhood of $a$ which is homeomorphic to an open interval. Hence $U' \setminus \{a\}$ has two components. This is a contradiction because $U' \setminus \{a\}$ must have at least three components.

Since fibers are finite and $X$ is compact Hausdorff, also $Y$ is compact Hausdorff (see https://math.stackexchange.com/q/3969891/).

Now let $Y' = Y \setminus \{p(a)\}$ and $X' = p^{-1}(Y') = X \setminus \{ a, b\}$. Then $p$ restricts to a $2$-sheeted covering map $p' : X' \to Y'$; clearly $Y'$ is Hausdorff. The space $X'$ has three path-components $X_1, X_2, X_3$ which are homeomorphic to $\mathbb R$. Hence $Y'$ has at most three path-components $Y_i$. Each $p(X_j)$ is path connected and thus contained in a unique $Y_{i(j)}$. We have $p(X_j) = Y_{i(j)}$. (Let $y \in Y_{i(j)}$. Pick $x \in X_j$ and choose a path $u$ in $Y_{i(j)}$ from $p(x)$ to $y$. It has a lift to a path $u'$ in $X$ starting at $x$. This path must be a path in $X_j$, thus $u'(1) \in X_j$ and $y = u(1) = p(u'(1)) \in p(X_j)$.)

Hence the restriction $p'_j : X_j \to Y_{i(j)}$ of $p'$ is a continuous surjection whose fibers have at most two points (it can easily be shown that it is a $1$- or $2$-sheeted covering map, but that is irrelevant).

No $Y_i$ can be compact. (If $Y_i$ would be compact, then $Y \setminus Y_i$ would be an open neighborhood of $p(a)$. Pick open neighborhoods $W_a, W_b$ of $a, b$ such that $p(W_a), p(W_b) \subset Y \setminus Y_i$. We have $p(X_j) \subset Y_i$ for some $j$. But $X_j$ contains a point $x_j \in W = W_a \cup W_b$, thus $p(x_j) \in Y \setminus Y_i$ which is a contradiction.)

Since $p'$ is a local homeomorphism, $Y'$ is locally Euclidean of dimension $1$. Moreover, $Y'$ has a countable base (take the image of a countable base of $X'$). Hence $Y'$ is a topological $1$-manifold with at most three components $Y_i$. Each $Y_i$ is either homeomorphic to the circle $S^1$ or to $\mathbb R$ (see {The only 1-manifolds are $\mathbb R$ and $S^1$). Since the $Y_i$ are not compact, they are homeomorphic to $\mathbb R$.

Let us identify $p'_j : X_j \to Y_{i(j)}$ (using homeomorphisms between $X_j, Y_{i(j)}$ and $\mathbb R$) with a map $g : \mathbb R \to \mathbb R$. Each $t \in \mathbb R$ has at most two preimages under $g$. We claim that $g$ (and hence also $p'_j$) is injective.

Assume that there are $x_1,x_2 \in \mathbb R$ such that $x_1 < x_2$ and $g(x_1) = g(x_2) = t$. The set $g([x_1,x_2])$ is a compact connected subset of $\mathbb R$, thus a closed interval $[r,s]$ with $r < s$ ($r = s$ would imply that $g^{-1}(r)$ is infinite).

Let us assume $t \in (r,s)$. Then we find $r', s' \in (x_1,x_2)$ such that $g(r') =r, g(s') = s$. Let $J$ be the closed interval with boundary points $r',s'$. By the intermediate value theorem $g(J) =[r,s]$, hence there is $x_3 \in J \subset (x_1,x_2)$ with $g(x_3) = t$ which means that $t$ has at least three preimages which is a contradiction.

Thus we must have $t=r$ or $t=s$. We only consider $t=r$, the other case is similar. Choose $s' \in (x_1,x_2)$ with $g(s') = s$. By the intermediate value theorem $g([x_1,s'] = g([s',x_2]) = [r,s]$. Hence each point of $[r,s)$ has at least two preimages in $[x_1,x_2]$. We cannot have $r \in g((x_2,\infty))$ (otherwise $r$ would have more than two preimages), thus $ g((x_2,\infty))$ is either contained in $(-\infty,r)$ or in $(r,\infty)$. If it were contained in $(r,\infty)$, then $g((x_2,\infty))$ would contain points of $(r,s)$ because $g(x_2) =r$. Each such point would have more than two preimages which is impossible. Thus $g((x_2,\infty)) \subset (-\infty,r)$. A similar argument shows that $g((-\infty,x_1)) \subset (-\infty,r)$.

We conclude that $g$ cannot be surjective which is a contradiction.

Knowing that the $p'_j$ are bijections, we now finish our proof.

If $Y'$ has one component, then each $y \in Y'$ would have three preimages.

If $Y'$ has two components, then two of the components of $X'$ are mapped onto a component $Y_1$ and the other component of $X'$ onto the second component $Y_2$. Hence the elements of $Y_2$ would have only one preimage.

If $Y'$ has three components, then we get three bijections $p'_j$ which implies that all elements of $Y'$ have only one preimage.

Therefore any covering map $p : X \to Y$ must be a homeomorphism.