Also I was treated very poorly as a research assistant in undergrad. Programming and technology is largely very welcoming to newcomers. However, no one wanted to listen to my ideas because I didn't have 15 years of degrees and a title with 3 different abbreviations.
It wasn't that Chemistry was less interesting, it just had much higher barriers for much lower payout. And you only get to live once.
I think I am grateful I failed to make it as a professional scientist, my lifestyle if much healthier as a software engineer. My job is not my identity, I work normal hours, I can take time off, I found new hobbies, I sleep more, I can stop working without guilt.