Defense doesn’t pay better than regular tech. The people in defense are doing it because they believe in helping the govt.
There are also missions people find valuable, like SBIRS ground, where theoretically real lives are being protected. I know a lot of people who enjoy finding meaning in their work, and there are many programs that bring that level of satisfaction (again, look at things like SBIRS ground).