Batteries. Why use 9V?
A 400mAh 9V battery will last a year with a 40µA current draw.
Now consider a smoke detector. It is low power analog circuitry, most likely drawing less than the 40µA figure above. If you wanted to power it from a boost converter and AAs, then you'd need a converter with very low idle current.
But... when there is fire, now you need quite a bit of power, and enough volts, to drive the piezo loudspeaker. These need voltage. 9V is louder than 3V.
So your very low idle current DC-DC converter also needs to output high current if needed.
You also need to be able to measure state of charge accurately on the AAs.
All this will cost more than the difference between 9V and 2AA. And remember, the customer pays for the replacement batteries, not the manufacturer!
First a AA is not a battery.. it's a cell. A battery is a "battery" of cells, i.e. more than one cell. A 9V battery contains six 1.5V cells. Rip one apart and see.
As for why we still use 9V batteries, it really is a matter of the design. The nice thing about 9V batteries is they give you a fairly wide operating voltage range during their life without being overly high a voltage. They also come in a really nice compact package that has a rather usable clip.
I would in no way recommend using one with a linear regulator to generate 5V though unless the current requirement on that 5V is very small. Better to design your circuitry using componentry that will work at the 9V directly.
It also really depends on the nature of your widget. If you have sensors or transducers that require larger voltages and it's battery operated, it's simpler and usually cheaper to go with a 9V battery.
One also has to consider the ramifications of boosting a lower voltage. By doing so you will introduce a lot of new problems not the least of which is the electromagnetic noise you will be adding and needing to deal with. Efficiency is also an issue.
But in the end, there is a lot of to and fro on the decision so this question really comes into the opinion ranks.
Boost circuits have a quiescent current; some energy is wasted simply by having the boost converter. They also get very inefficient at low duty cycles.
So if you have a circuit that usually draws a very small current but occasionally needs to draw more, it's difficult to address that with a single boost converter.
The main users of 9V batteries are things like smoke alarms and multimeters that exactly fit this use case: low current some or almost all of the time. If you expect the battery life to be less than, say, 3 years with a 9V battery then it may be a poor choice.
You can see this in that almost anything that has a radio - toys, remote controls, etc - will be using either several AA or rechargeable Li of some sort.
Boost converters aren't free either, they cost parts and space.
(The design that allows cheap wall clocks to run off a single AA battery is quite neat, and I'd like to see a good reverse engineering of it.)