I think you can also partially think of it as a gamble (similar to doing a startup).
For example, I did a machine learning related PhD that propelled me into my dream job, earning about 3x more than I would have otherwise.
My motivation wasn't money though, and that's probably the mindset you need, but it's not guaranteed to be a bad outcome financially :-)