I think "learn how to Code" is itself code, it just means find another career path because what you're doing now is going away. It's no different than being a sail-maker when the world was switching from sail to steam, or a buggy whip maker, etc.
Unfortunately there's a lot more to that. You're not just changing one job for another. You're giving up on your cultural identity. Face it, if no one in your family was ever a coal miner, why the F would you want to be one. But if your father, grandfather, uncles, neighbors were coal miners, yeah there's an identity there. And it's an identity that's been romanticized and glorified beyond its reality and importance in the grand economic scheme of things. That's a lot to give up.
Plus the region is bound up in that culture, making leaving especially hard. Because, face it, retraining for another job isn't going to cut it. Many of these people, esp the younger ones, need to get the hell out of there. Jobs are not going to come flooding into the area just because a bunch of them are now coders, or plumbers, or carpenters, or whatever.
People might complain about immigrants\migrants taking their jobs because maybe they're willing to work for less but there's another reason nobody mentions: THEY"RE MIGRANTS. They're willing to go to where the jobs are, whatever those jobs might be. They're the ones that have no problem picking up and moving if that's what's necessary. You think some guy that just traveled 1000's of miles and possibly risked the lives of themselves and their family for a better life is going to give 2 shits about moving from AZ to VT or NB or wherever?