But there is "application penetration testing" and just application security in general which tends to pay competitively with software engineering. And of course plenty of people do both at the same job.
So pentesting can be competitive but it depends on definitions a bit. That said on the upper end, software dev tends to have more chances to get a big exit by being part of building something. In security you might be with a consulting firm where you have a slight chance at that, but its not common for a security guy to have that sort of big exit.
That being said right now security is becoming a very lucrative field and you know what to do to make money in a gold rush especially if you're a software engineer.
I found most of the pentesting salaries came in lower than engineering ones, and I felt that pentesting was the more difficult job.