Uhh.. I guess outside of the hobbyist crowd (and a fraction of it), the atmega8u must not be used much anywhere anymore. It's extremely limited. The STM32F103 has been used and abused pretty much everywhere. Of course the latter will be unobtainium way earlier.
You can't compare those. Completely different league. It's almost like comparing a Smart Fortwo and a Dodge Viper.
The Atmega8 series was released in 1996. The STM32F103 was launched in 2007. Yeah. Don't know the process node for the Atmega8u but it's probably a significantly older process.
There are tons of closer alternatives to the F103. Now availability will still be a bet at this point. Something available today may not be in 3 months. That's a general issue that doesn't have any magic solution that I know of.
High demand is on one hand a sign that some chip would know shortage earlier, but OTOH, low demand can mean that it gets very low priority in fabs and thus, you'd only get whatever is still in stock, and after that, it might get worse than high-demand ones...