You sound like a dude so I'll give you a bit of perspective on your advice from a woman's perspective.
It would take months, if not years, for defensive tactics training to be ingrained into muscle memory, and even then, unless you've been attacked in a real life situation numerous times, you won't be able to effectively execute whatever training you received.
I have used pepper spray on two separate occasions on men in nyc. It saved my life. Using pepper spray isn't rocket science (and comparing it to learning code seems tone deaf). Separately, the vast majority of people have never been pepper sprayed, the risk that someone you use it on as a defense mechanism has been exposed to it so many times they've developed a tolerance to it is so so so low. Like low enough that it's virtually ridiculous to suggest that it would be an issue. And even further that most people would use breathing techniques to counteract the effects. Unless you're being attacked by a cop who has deployed pepper spray numerous times.
I'm definitely all for being aware of your surroundings, especially as a woman. But I actually think your advice on taking those defensive tactics training courses is way more akin to telling unemployed people to learn to code than telling women to buy pepper spray to protect themselves.