“Learn to code!” has its foundations in market value, it's suggested as a way up, a way out. “Learn to code” goes on your resume.
But let’s substitute a different phrase: “learn to cook.” People don’t only learn to cook so they can become chefs. Some do! But far more people learn to cook so they can eat better, or more affordably, or in a specific way. Or even sometimes because—get this—they love spending time with the person who’s teaching them.