Why are macarons so expensive?
Because they are extremelyto make and many of their ingredients can be expensive and/or difficult to source.
Macaron shells are made by folding (or some other nut flour) and confectioners sugar into a meringue (sugar and egg whites). Sounds easy enough, but it has to be done just right. The ratio of sugar-to-almond flour-to-egg has to be very precise — you have to weigh your ingredients to the gram; you can't do it by volume. I suppose you could but it could easily mess up your batch.
Assuming you've even measured the ingredients properly, you need to fold it correctly. Under-mix and they'll be stiff. Over-mix and they'll be goo. You have to pipe the shells to be uniform in size, rest them so they can lose their peaks and watch them like a hawk for as long as they're in the oven. If anything anywhere in the process goes wrong, the entire batch can be lost. And macarons are as much about looks and style as taste; a cookie that tastes good but is burnt, missing its foot or cracked will not cut it.
The fillings don't have to be that difficult. I've used buttercream, ganache and candied fruit, among others. It's the shells that pose the difficulty, and unless you want a plain shell, you'll need to invest in good-quality vanilla, edible flowers, cocoa, flavor compounds, spices and dye. Most of that ain't cheap, and neither is almond flour, unless you buy it in bulk.
In summation, the comparatively high cost of macarons is a function of their difficulty to make; the time it takes to make them; and the cost of their ingredients, many of which are highly specialized. Most people are also unwilling or unable to make them at home (they are not cupcakes and there is no boxed mix for them), so they're willing to pay more to get them from a bakery.