Masters in math, bland PhD in CS, want to go back to math
The main thing you will have to show for the three years is your thesis, so the first objective should be to finish it on time. If you feel the project is at a dead end, maybe you can target making your thesis the capstone that closes it out. Turn your papers into sections each of which resolves a loose end. That way, it does not matter if they don't relate to each other.

Meanwhile, can you audit courses in the mathematics department? Get to know some of the mathematics professors, and get their advice on how to transition.

Don't feel too old - I was 60 when I finished my PhD, and I'm still learning new stuff. You have decades of research in front of you.