$15B paid out to developers, while the ecosystem is the one what keeps an $500B company on the top - this does not seem to be that much.
$15B is two aircraft carriers. In less time to build one.
Arguably that was due to the success of iOS. I don't think it's ridiculous to suggest that the app ecosystem contributed to that.
But you're right they're completely different in a lot of ways. Apple "builds" more than one aircraft carrier a year (in total cap ex spending), the US Government takes ~10 years to spend the same money to build one.
It used to be the other way around, Microsoft bragging while Apple and fans claiming that quality was more important than quantity.