What do you mean how stupid is that? Most of the people who join the military do so while they are still young (18 to 24), and the reason that those of lower rank are more numerous than those of higher rank is because of the way the military is structured.
And yes, if you go into a job that is classified, you will be training with most of the stuff you will work with for the rest of the time you are in. Everyone who joins gets what's called a NAC (National Agency Check), where they check your name and SSN against the databases in this country to make sure you disclosed all information concerning civil involvement (arrests). If you go into a security field, they do a further investigation that takes up to 6 months to a year to complete, and you are only given an interim clearance until your investigation comes back and you get your full clearance. Once you get your full clearance, you then work fully in your field.
As far as the crappy pay? Hey...............nobody ever joined the military to get rich, and if you think that the military isn't paid enough (I for one do, since everyone in the military who is E-5 or below is paid at a level that makes them eligible for many assistance programs such as WIC or SNAP), then talk to your congress person about increasing the pay for the military. Even at the higher ranks, a person is only making about half of what their civilian counterparts pull down.
Sorry, but there is no way to ensure that a person won't be tempted to spy on their country, as there are some out there who can be bought. Even though there are screenings and in some cases, psychological testing, there will always be a few that slip through the cracks.