I don't have a lot of ideas or a bold direction, I tried to generate such function in Desmos and it kind of seems to exist but I don't know the formula or even if it is elementary or not. I do know that:
$f(0)=0, f(x)=f(x+\pi)$
I also know that if $f(a)=b$
It means that $f(f(a))=f(b)\rightarrow f(b)=\sin(a)$
And if we apply this formula to itself a couple of times we get cool stuff:
$f(f(b))=f(\sin(a))\rightarrow f(\sin(a))=\sin(b)$
Apply this a general N times and get that $f$ of sine composed over itself repeatedly N times of (a) equals to sine composed over itself repeatedly N times of (b). A friend suggested I use the Weierstrass factorization theorem to prove no such function exists or no elementary function as this exists. But im not sure how it'd help, and he didn't solve the question either just brought up the idea. If anyone has the formula or the non-elementarity proof please answer
ELEMENTARY AND DISCRETE FUNCTIONS ONLY.