The concept had been approached from several angles.
Many nations touched on the concept of some kind of automatic weapon firing an intermediate cartridge. From the French Ribeyrolles semi-automatic rifle to the suggested .276 Pedersen BAR and M1 or the Russian Fedorov and several other designs.
Full power ammo had become the requirement in most armies at the end of the 19th centuries that expected troops to engage at long ranges over open sights volley firing away at the enemy.
Until they realized they needed close range firepower for which the only suitable ammo was pistol-calibers.
They then looked at intermediate cartridges like the US .30, the German 7.92mm Kurtz, or the Soviet 7.62x39.
Nothing the Germans came up with was new, it had been figured out at some point in another weapon. What they did was create a really handy, highly effective new combat weapon.
Meanwhile the Soviets have a well-documented history of working on a range of semi-automatic rifles, some prototypes using a similar magazine as the Fedorov. They came up with the 7.62mm based on a pre-war general military study.
Note however that when the AK is finally developed, the main weapon of the Red Army is the SKS and the AK was meant to replace the PPSh in the SMG role. It took a few years for the Soviets to figure that the AK was a superior weapon to the SKS.
The various claims that the Soviets needed the Germans to make the AK are circumstantial at best. According to reports the Germans were kept separate from their own design teams and worked on other projects. Similarly Kalashnikov was already involved in design at various points before working on the AK. He had been tinkering with things since he was a kid and had a natural aptitude for all things mechanical.
Mechanically the weapon is very different from the German version and is a straight continuation of previous Soviet designs.
Did the STG inspire Kalashnikov ? Well the answer is more complicated that that. The Soviets had many designs going during and after the war, all sharing a very similar pattern with the German STG, clearly they were all competing to be the best design of a certain pattern of weapon requested by the Red Army. Is that pattern based on an early captured version of the MKB42 or similar design ? Probably. Copying the pattern of a new design isn't new or even extraordinary. The French came up with the modern bolt action weapon and everybody rushed to make their own version, they did the same for the 1897 75mm gun, or Maxim's revolutionary new weapon the automatic Machinegun.
Almost every part of the M16 is derivative of an earlier design and nobody has ever accused Stoner or Sullivan of merely copying other designs.
The Soviets were the enemy and anything you could find to make them seem incompetent would be used against them, once people heard Schmeisser and others were kept in Germany for several years they attributed each and every gun in the post-war Soviet arsenal to their hand. How did we know the Soviets were incompetent ? The German generals told us, that they had no finesse or skill and only won because of the brutal winters and hurling endless hordes at every problem.
And we still believe that narrative to this day, despite Soviet and German archives telling a very different story. The reality is that Soviet engineers were quite competent in their own way, were clearly forward-thinking and made stuff that worked if it lacked the extra spit and polish a capitalist system could afford to put into the gear they gave their soldiers.
The AK is a highly successful design no matter what.