Suppose that we have two functions $f(x)$ and $g(x)$. We know that $f(x) \ne g(x)$ on the interval, except for measure zero subsets of $[a,b]$. Assume that both functions are positive everywhere and both are strictly increasing almost everywhere (i.e. there is a subset $S$ of the interval $[a,b]$, where $[a,b] \setminus S$ has measure $0$, and $f, g$ are strictly increasing on $S$).
Under these conditions on $f$ and $g$ (positive, strictly increasing a.e.), is it possible that there exists a non-constant polynomial transformation $P$ such that $P(f(x)) = P(g(x))$ almost everywhere on $[a,b]$?

I think that the following is a counterexample:
Let $f(x)=\sin(x), g(x)=-\cos(x)$ on $[0, \frac{\pi}{2}]$ and $P(X)=X^2(1-X^2)$.
Then $$P(f(x))=P(g(x))=\sin^2(x) \cos^2(x)$$