The trace operator $T$ is defined for bounded domain $U$ with $C^1$ boundaries as the linear, continuous operator
$T: W^{1,p}(U) \rightarrow L^p(\partial U)$
such that
$$
Tu=u\;\text{ on }\partial U
$$ whenever $u$ has a version that can be continuously extended on the closure of $U$.
Intuitively, this is supposed to describe $u$ on its boundary, so I would expect that if, for a suitable real valued function $g$, we have that $g(u)$ is in $W^{1,p}$ we would have furthermore
$$
Tg(u)=g(T(u))\;\text{ for all }u\text{ on }W^{1,p}.\label{1}\tag{1}
$$
This happens for instance in the case when $u$ has a continuous extendable version.
So the question is: does \eqref{1} actually hold?