It can be — but the honest version of that answer has some caveats attached.
Programming is one of the better-compensated disciplines in the industry, and skilled engineers are genuinely hard to replace. If you enjoy solving puzzles under constraints and you like seeing your work played by millions, few jobs scratch that itch the same way.
Games work is competitive, and studios often cluster in a handful of expensive cities. Crunch has been a persistent problem in parts of the industry, though it varies enormously by company. Pay at a large studio may also trail what the same skills would earn in finance or general software.
The people who thrive tend to be the ones who would be building things anyway. Learn to code properly, ship something small of your own, and treat the games part as a bonus rather than the whole plan.