I'm not a mathematician. I was a college math major, got a PhD in physics, and still enjoy math.
It's not like "should I get a PhD" is a new question. It's not unheard of for unpredictable events to drastically affect the career prospects of PhDs in my field. During my lifetime:
1. Mandatory retirement of professors was ruled illegal. While good for civil rights, it created a 10+ year gap in faculty retirements.
2. End of the cold war.
3. Transition of college teaching from tenured professors to gig workers, aka "adjuncts."
The one constant during this time was the perpetual optimism of the faculty for the employment prospects of PhDs. "There will always be a need for physicists." My dad, also a PhD, confirmed that this goes back as early as the 1950s.
I would add one question to the student's letter: What are the ethics of AI and its owners?
Philip Greenspun has a 2-decade old essay that is relevant:
https://philip.greenspun.com/careers/women-in-science
Basically, it's arguing that science (really academia) is generally an awful career path for most Americans.
> Transition of college teaching from tenured professors to gig workers
This is a huge, and likely permanent, change.