Let $(X,d)$ be a compact metric space and $\sim$ an equivalence relation on $X$ such that the quotient space $X/\sim$ is Hausdorff. It is well known that in this case the quotient is metrizable. My question is, can we choose a compatible metric on $X/\sim$ so that the quotient map does not increase distances?

As in this question

we can define a pseudometric $d'$ on the quotient $X/\sim$ by letting \begin{equation*} d'([x],[y]) = \inf\{ d(p_1,q_1) + \cdots+ d(p_n,q_n):p_1 = x,q_i \sim p_{i+1},q_n=y\} \end{equation*} where $[x]$ is the equivalence class of $X$. With this $d'$ the quotient map clearly does not increase distances. So do we know when $d'$ is a metric and when it is compatible with the quotient topology? Wikipedia says that $X$ being compact implies that $d'$ is compatible with the quotient topology; I would appreciate a reference or a quick proof.