The problem is right now these things do indeed depend on dirty energy. You're basically making the same fallacious argument as politicians do now. In the long run, everything will be green. That's not the point. The point is how we get there. You can't ignore the present or the engineering involved to get to the future.
How did we get the first railroads built? By a combination of horses dragging materials so humans could lay the rail lines and then trains dragging materials as the initial lines were built. There was almost certainly an initial increase in horse power consumption, and then a decline as the new system came online. This isn't a new thing, this is how many replacement transitions that depend on the previous system play out.
Right. But right now we're incentivizing the opposite. We're telling fossil fuel companies we don't need them anymore long before we've actually figured out a way to live without them. Do you see the problem yet?
CA is not banning sale of ICE cars. They are banning sale of new ICE cars.
I think the easier way to look at it, though, isn't the upfront cost of the transition, but the outcomes that are 10-20 years down the line. A big "spend" right now should result in less overall carbon emitted (according to most of the lifecycle analyses that I'm familiar with, anyway).
It's a really good point that we need to optimize this, of course. It would be ideal to manufacture solar panels in places with a favorable energy mix versus somewhere that's still 100% coal. But in a lot of cases, it's better just to get the things out the door as fast as possible using the technology we have.
We should be bringing Si mfg back to the US where we have plenty of methane("natural" gas) needed to do so. We should build more fission. We should continue to buy solar panels, rare earths and Li from China, as long as they're willing to sell it to us. But none of this is an either/or decision. We need a realistic path to the green future or we risk screwing up the transition, ruining our economy and setting ourselves up to have regressive political revolutions.
This may be true for certain products, but it's not broadly true. There's nothing intrinsic that requires solar panels, lithium ion batteries, or wind turbines to be manufactured using dirty energy.