Good results come from good national teams. Good national teams come from national players playing for the best teams in the world, against other best teams in the world.
Good national players come from good youth academies. Specifically, strictly meritocratic academies where hundreds of thousands of young players start around age 8, and get regular game time against other high quality opposition. At every opportunity, if someone is way better than their opponents, they must be moved up to the next level, to avoid developing bad habits that only work against unskilled players.
This keeps being true all the way up the pyramid, with elite prospects needing game time in the highest leagues in the world (despite being unproven/ not good enough to compete there yet!) else they won’t learn to perform at that level. That’s a huge sticking point too, it’s a massive investment for a giant club to buy and then play a youth player instead of an established veteran.
A big problem for non footballing nations to build the game is A) investment in youth setups and B) getting enough high quality game time to train the products of the academies to the point players regularly make the move to the top 5 leagues.
In both cases it comes down to investment yes, but also using that productively (hiring players to develop a competitive local league for your domestic talent to learn their craft in, and building a pathway for domestic talent to make it there). That’s a big barrier in corruption prone nations, because investment tends to fall into people’s pockets instead of going to these goals




Countries can’t really buy the best players: for the most part a national team can only consist of citizens of that country. Switching nationality is possible but heavily restricted and very rare, and can only happen once in a career, before they’ve played more than a couple matches