Yes. Which goes back to 'if my community doesn't value teaching, why should I do it?' In that case, I'll use my background and skills to help those in my immediate circle and their children - people who do value it. Or make use of other skills I have that are more valued even if I like doing them less (I would prefer to teach over code but shrug).
If society heavily implies "teaching is stupid and has no value" then of course fewer people are going to be teachers. How many SWEs would keep doing the job if it paid 20k a year, required reporting to multiple people, asked for a Master's+, and involved verbal abuse? I'm guessing most people who like to code still wouldn't take that job; they'd do something else and code in their free time.