Of course there's a whole other wing to their factories for sorting pieces into sets, they release hundreds of different sets a year which design teams spend months prototyping, they spend huge on marketing, community outreach, and licensing fees, and a non-trivial portion of their manufacturing capacity goes to Legoland resorts and projects like this Bugatti Chiron build. Nonetheless, the Lego group commands Apple-like profit margins.
Still, for the consumer the value proposition on a Lego purchase is very good, because it's value doesn't depreciate over time. In fact, vintage Lego sets have appreciated on average 10% per year over the last decade. Buying Lego is money in the bank, presuming you keep your Lego inventoried and save the boxes, stickers and instructions.