I have obtained multiple bachelor's degrees and a master's degree. I'm very motivated to pursue an academic career, for which obtaining a PhD seems like a necessity. However, I find it hard to decide on what kind of PhD positions I should be applying to. I often feel like a subject would be interesting enough to work on for multiple years and fits my master's degree quite well, but I really want to be moving in a different direction (specifically, I have two bachelor's, in mathematics and in computer science, and a master's in AI; after my master's I sadly have to conclude that I prefer topics on the border of computer science and mathematics rather than most of what's considered AI nowadays).
I'm having very little success in pursuing those PhD positions that look the most interesting to me. I feel like I would have an easier time if I broadened my search to include any subject I think I could keep up for 4 years, but I worry that this would 'lock me in' to this area of research.
Are my feelings justified given the way things work in academia and would it be justified to say that wanting to pursue an academic career I should not be applying to anything that straightforwardly doesn't fit that career path? Should I be happy to get into any PhD program at all, and accept that my options are rather limited? Or am I worrying needlessly, and would it not be at all unrealistic to make major lateral moves within my academic career, towards mathematics?