I know the composition of Riemann integrable functions is not necessarily Riemann integrable. But I am not finding any argument how to conclude this for self composition, or how to find a counterexample. $f$ is Riemann integrable on $[a,b]$ means that the discontinuity set of $f$ is of measure zero. But the discontinuity of the composition is a larger set, so we cannot conclude anything.
Similarly for the self composition of measurable functions: is it measurable or not? I am unable to find a counterexample.