Those STEM majors leaving the field often get salaries higher than people who majored in that field going into it. It seems that these employers value the STEM education moreso than people who major in the same field.
Second, it is entirely possible that these STEM majors voluntarily left the STEM field. More people are doing STEM but that doesn't mean more people are passionate about STEM. Engineering isn't for everyone, and I myself have thought about leaving the field and going elsewhere not because I can't find a job but because I want to.