Up to this point, a tech career has a lot more options and opportunities. Didn't get google? Work at a bank, a startup, a salesforce solutions techshop.... Didn't get MIT? There are other paths forward, including quirky ones that will work too.
Past this point, well-to-do lawyer at Biglaw has the cushier path. Law firms respect seniority. They give them nice offices, autonomy. Senior partners don't worry about wippersnappers running circles around them in some new law paradigm. They don't need to relearn contract law periodically.
The point about happiness is valid, but complex. That competitive prestige game is, empirically, often misery making. Programming has more realness, but there can be a lot of performance stress, especially if you're thinking in decades.
Everyone goes into law school thinking they will be the one to get high grades, but in my experience, working hard was not well correlated with good grades. Even if you work harder than anyone else, it still somewhat comes down to a coin flip. This can be so frustrating, I cannot even begin to describe it.
Even if you then make it into biglaw (a low percentage), you then need to make partner (an extremely low percentage). This is far more about a) office politics, b) connections, and c) your ability to "rain make" by bringing in big new clients; than about your skill as a practitioner of law.
I would also caution against looking at numbers like salary in isolation. Law is full of unhappy rich people. 36% of the profession suffer from alcohol use disorders, compared to ~12% of the general population. Nearly half experience depression at some point (compared to 15% in the general population, in the stat I was able to locate). It's not a happy field.