There exists the following metric counterpart of the Harris result:
Theorem (Banakh, Vovk, Wojcik): Each metric space $X$ can be (canonically) identified with the space $\pi_0(\circledast(X))$ of path-components of some complete metric space $\circledast(X)$.
The space $\circledast(X)$ is a closed subspace of the complete oriented graph with vertices in the set $X$.
The above theorem follows from Theorem 7.3 and Proposition 7.4 of this paper published in Fund. Math. 212 (2011), 145-173.
More generally, the Theorem holds for weakly first-countable spaces containing no countable connected subspaces. To formulate the general and more precise version of the Theorem, I need to recall some definition and results from this paper of Banakh, Vovk and Wojcik, which will be cited as [BVW].
So, I thank Jeremy Brazas for opportunity to advertise this my paper [BVW] :)
Unfortunately, writing the paper [BVW] we did not know about the paper of Harris. After looking at the Harris' paper, I discovered that his construction of the space $S(X)$ (with $\pi_0(S(X))\cong X$) is similar to our construction of $\circledast(X)$ with $\pi_0(\circledast(X))\cong X$. But our space $\circledast(X)$ always is complete metric. As a result, our construction works only for premetric (= weakly first-countable) spaces.
Let us recall that a topological space $X$ is weakly first-countable if to each point $x\in X$ one can assign a decreasing sequence $(B_n(x))_{n\in\mathbb N}$ of subsets containing $x$ such that a subset $U\subset X$ is open if and only if for each point $x\in U$ there exists $n\in\mathbb N$ such that $B_n(x)\subset U$.
By Proposition 3.7 in [BVW], a topological space $X$ is weakly first-countable if and only if the topology of $X$ is generated by a premetric $p$.
A premetric on a set $X$ is any function $p:X\times X\to[0,\infty)$ such that $p(x,x)=0$ for all $x\in X$.
The topology generated by a premetric $p$ on $X$ consists of all sets $U\subset X$ such that for every $x\in X$ there exists $\varepsilon>0$ such that the $\varepsilon$-ball $B(x;\varepsilon):=\{y\in X:p(x,y)<\varepsilon\}$ is contained in $U$.
A premetric space is a pair $(X,p)$ consisting of a set $X$ and a premetric $p$.
To each premetric space $X$ we shall assign some special complete metric space $\circledast(X)$, called the cobweb of the premetric space $X$.
The cobweb space is a closed subset of the complete oriented graph $\Gamma X$ over the set $X$. The complete oriented graph $\Gamma X$ is the set $X\cup\{(x,y,t)\in X\times X\times(0,1):x\ne y\}$ endowed with the path metric $d$ (in which every oriented edge $[x,y]=\{x,y\}\cup\{(x,y,t):0<t<1\}$ has length 1.
For a premetric space $X$ endowed with a premetric $p$ the cobweb $\circledast(X)$ is defined as the closed subset
$$\circledast(X):=X\cup\{(x,y,t)\in\Gamma(X):t\le 1-p(y,x)\}$$of the graph $\Gamma X$.
The compression map $\pi_X:\circledast(X)\to X$ assigns to each point $a\in \circledast(X)$ the point $a$ if $a\in X$ and the point $x$ if $a=(x,y,t)$ for some $x,y\in X$ and $t\in(0,1)$.
The following theorem follows from Theorem 7.3 and Proposition 7.4 of [BVW].
General Theorem (Banakh, Vovk, Wojcik) Let $X$ be a premetric space. Then:
- The cobweb space $\circledast(X)$ is complete metric space of dimension $\le 1$.
- The compression map $\pi_X:\circledast(X)\to X$ is a continuous quotient surjection with path-connected fibers $\pi_X^{-1}(x)$, $x\in X$.
- The space $\circledast(X)$ is connected if and only if $X$ is connected.
- If $X$ contains no countable connected subspaces, then the fibers of the compression map $\pi_X$ coincide with the path-components of $\circledast(X)$ and also with the separablewise components of $\circledast(X)$;
We recall that the separablewise component of a point $x$ in a topological space $X$ is the union of all separable connected subspaces of $X$ that contain $x$. It is clear that the path-component of $x$ is contained in the separablewise component of $X$.
Since the topology of a weakly first-countable space is generated by a premetric,
the General Theorem implies the following corollary answering the question of
Jeremy Brazas in (strong) negative.
Corollary 1. Each weakly first-countable space is homeomorphic to the space $\pi_0(M)$ of path-components of some complete metric space $M$.
Taking for $X$ any connected Hausdorff space, we obtaine the following surprising
Example. There exists a connected Polish space $P$ such that $P$ has countably many path-connected components and each path-connected component is closed in $P$.
It seems that for separable space $X$ the space $\pi_0(X)$ also can be homeomorphic to $[0,1]$. A possible counteexample can look as follows:
Let $$C=\big\{\sum_{i=1}^\infty
\frac{x_i}{3^i}:(x_i)_{i\in\mathbb N}\in\{0,2\}^{\mathbb N}\big\}$$ be the standard Cantor set in the unit interval $I:=[0,1]$.
Let $\mathcal J$ be the set of connected components of the complement $I\setminus C$.
It is clear that each set $J\in\mathcal J$ is an open interval of lentgth $\frac1{3^k}$ for some $k\ge 1$.
For $n\in\{0,1\}$ let $\mathcal C_n$ be the subset of $\mathcal C$ consisting of intervals of length $\frac1{3^{2i+n}}$ for some $i\ge 0$.
Let $J_n=\bigcup\mathcal J_n$.
Now consider the following compact subset $$X:=(C\times[0,1])\cup(\{0\}\times J_0)\cup(\{1\}\times J_1).$$
I hope that the space $\pi_0(X)$ of path-components of $X$ is homeomorphic to $[0,1]$.