> I love doing math, but it has an opportunity cost.
I'm not sure you love doing math if you think of it as an opportunity cost rather than as an opportunity. You love what it earns you, not math itself.
Anyway, I'm in the same boat. I finished my PhD already having come to the conclusion that I, too, did not have as big of an appetite for math as I thought (I don't regret pushing myself through the burnout at the expense of some mental health, either). I still indulge math and research from time to time, but with this lack of attachment to results or social approval, I find AI invigorating rather than despairing.
Anyway, I am also very glad I finished my studies before AI took off. I don't envy your position. Please take care and be lenient with yourself; you're not the only one wondering WTF is going on or what we're supposed to be doing right now.
Maybe you just love going outside and doing other things more than you love math and it's not really about AI at all.