Please remember, a lot of smart people got burned after the dot-bomb. It's not like that sat around for a few years waiting for work to pick up on the internet. A lot of engineers went into defense, unlike the bay area, they pay in cold, hard cash. You rarely ever hear of a defense company going under.
Think about it, ALL startups in the silicon valley, COMBINED (even with Facebook's 15 billion evaluation), are not worth not even 10% of the 530 billion dollars a year that is the defense budget.
You're comparing the valuations of software startups with the entire operating budget of the military? You first need to discount salary, equipment, maintenance, etc, all costs not relating directly to software.
A more realistic comparison would be comparing the defense budget to the entire economic output of the bay area. Even then it's apples and oranges.
I know several smart people who could do my job working for defense companies.
But I make more money than most of them. Like most jobs, there is always a tradeoff between stability and money.