There is actually a highly useful intersect between software development and security, but that would be in application security rather than computer or network security. Having an understanding of web application and other types of software development is highly beneficial for application penetration testing (one form of white hat hacking). However, computer and network security do not benefit much from software development experience except in the case of some scripting knowledge, which is not usually covered in a software development curriculum.
The best path to take based on how things are moving in the software development industry would be to learn web application development and then move into application security. There are a huge number of application security engineer positions being posted all the time, and they pay extremely well. If you wanted to specialize and stay in one area and be a hobbyist in the other, I would actually recommend going into security and making software development your side hustle or hobby. It is much easier to perform freelance software development work than it is with ethical hacking. Ethical hacking is a bit more time and resource intensive, whereas you can chip away at software development in your free time more flexibly.