Let $f$ and $g$ be analytic functions in the unit disk $D$, continuous in the closed disk and locally univalent, $f'(z)\neq 0,\; g'(z)\neq 0,\; z\in D$. Assume that each has only finitely many singularities on $\partial D$, so that the images of $\partial D$ are piecewise analytic.

Suppose that there exists a homeomorphism $\phi:\partial D\to\partial D$ such that $f(z)=g\circ\phi(z),\; z\in \partial D$. (This means that the images of the boundary under both functions are reparametrizations of the curve). Can we conclude from this that $\phi$ extends to a conformal automorphism of $D$?

Same question about meromorphic locally univalent functions.

Motivation: this is so, if $f$ and $g$ are globally univalent (injective). Indeed then they map the unit disk on plane regions with the same boundaries, so the images coincide.

EDIT. This is related to my other question:

Greatest lower bound for subordination

and using Milnor's counterexample mentioned in Misha's answer, one can construct a counterexample to the other question.