That said, "running out" of oil isn't necessarily a real problem for the US, as we're net exporters of oil. The oil we export isn't the same kind as the oil we refine, but we could build refineries to refine our own oil and achieve "independence" that way. It'd just be less profitable.
Germany makes a lot of high quality solar panels.
But whether you like China or not, buying their panels and equipment to make yourself energy independent is a reasonable option, especially if (when) their products are good quality and priced well.
Your independence is only at risk if China decides to stop offering you the things you need. In that case, your future supplier will have to change. But not only is that unlikely to happen, it's irrelevant to the NOW. In the NOW, you could be buying tons of what you need to become self-sufficient.
Fact of the matter is still getting your source of energy from India, when you are not India, is still not energy independence either, regardless of whether or not you do or do not like India more or less than China.
The craziest part about all of this is that Europe is quite literally not independent in any way whatsoever, especially not in matters of energy of any kind.
Until there's a geopolitical event occurs and your supply chain gets cut off so any expansion, warranty, or replacement units cannot arrive, so you're stuck at the your current level of deployment (which may or may not be sufficient for your needs).
From a geopolitical standpoint running a country on locally produced renewable power is obviously the least risky approach, even if you get cut off from further expansion of your renewable production.
And it's not like you cannot find good alternatives outside of China. They may be more expensive, but they exist (and are high quality - Germany).
Are people really suggesting the opposite: that the renewables transition should not occur, and the EU should continue to burn gas from more and more desperate sources, until it can be onshored?
All of the materials used are readily available and manufacturing is not incredibly difficult. Inverters and control circuitry is way more of a risk than the panels themselves but there are stockpiles and sources that are good for many places
Barring significant damage, you can maintain approximately your current level of power generation for years at a time without more than routine maintenance.
Fossil fuel power requires constant input of, well, fossil fuels.
So while what you're saying is true, it would be a ludicrous stretch to say that it brings solar panels within a few orders of magnitude of fossil fuels in terms of dependency on foreign powers.
The more failure prone component is the inverter, by a huge margin.
By coincidence I had my solar panels installed round about the time construction started on Hinkley Point C. They've already paid back their installation cost. I don't expect to replace them any time soon.
The photos hitting my solar panel don’t travel through the straight of Hormuz.