That misses the important point that the business itself has value. You can sell businesses, either to someone who would be quite happy with the $100k, or someone who wants access to the business assets (clients, stores, cupcake recipes, brand, etc).
If you work the legal job for 3 years and earn $250k a year, you'll have $750k. If you build a cupcake business over 3 years, draw $100k in salary from it, and then sell it for $1m, you come out ahead.
This isn't a case of "You can fiddle the arithmetic to make it better"; it's a case of "the business owner is building an asset as well as drawing a salary." If you quit the legal job, you don't get any more money out of it. But if you decide you don't want the cupcake shop any more, you can get dramatically more than a year's salary as a result.