@Messi983
OK I will try to be concise a little bit.
First, extra-sportive factors. Morocco since the turn of the century is betting on soft power. Morocco is not an industrial, or naturally resourced country. The country has gone into this direction : be diplomatic, be influential, incite foreign capital, bet on soft power.
This stratgery, locally debated, has given some fruits. From a touristic point of view , Morocco is certainly heading to be a global destination. Diplomatically, Morocco is doing great, foreign capital is coming, now remains soft power.
So this is more or less the eagle-view point to why football holds a political importance. Hence the repetitive candidacy to host a world cup.
Culturally, nothing needs to be said. .. morocco is a football passionate country.
Now. Purely football. Why the success ?
Moroccan FA investment of resources as well as efficiency. The moroccan federation for example has an army of people specialized in obtaining young double nationals from all over the world (communication, enticement etc). The federation has invested big money on infrastructure for clubs. Biggest factor is the construction of an academy with state of the art facilities , specialized in developing talents while living there à la Masia. After graduation. These players are free to sign for whatever club (local or foreign). This academy has produced players that were instrumental in Qatar world cup as well as this U20 world cup.
Now.. another factor is rational coach selection. For senior team coaches now the pattern is this : 1 be moroccan 2 prove yourself with trophies 3 we will give you a chance. It worked not only with regragui (Qatar 2022) but with other coaches too , same pattern (think Skitioui during olympics).
We as locals already (from the pattern) can guess the next senior team coach.
This is more or less the gist as to why morocco is becoming a global force, and I suspect it will remain so for a while. Because there is also the snowball effect. Success will entice more double nationals in the future to represent morocco and yamal from what I read was really really close.