That's exactly what I've done. I'm 32 and have years of exp in data engineering and data analysis. I wanted to pivot more to more eng. I did a lot of interviews with a lot of product eng offers, but ultimately went for infra, now working on a cpp and java stack.
Feels like there's more staying power here. On the product side I would have been sprinting to director level people management as fast as I can. On infra I feel like I can stay an IC indefinately
Even though I have an ML background, I don't feel like competing with every young hotshot out of MIT and stanford for ml eng roles, so going to opt out for now and focus on systems