I'd be willing to concede for the sake of argument that there aren't enough raw materials to replace all the world's combustion vehicles with EVs the way we currently do EVs. Almost certainly not if we keep using batteries high in nickel and cobalt.
I think what we should be doing instead is building EVs with modestly-sized batteries and focus instead on making charge stations more available and electrifying the major highways so that cars and trucks can travel long distance cross country without ever having to stop to charge.
The problem with hydrogen or ammonia is that, without some major technological advance, you lose a lot of energy in the process of making the fuel, transporting it, and converting it back into kinetic energy either in a combustion engine or fuel cell/motor. If you can synthesize the fuel with solar power but only 30% or 40% actually ends up doing useful work, then it's far less efficient than using batteries and electric drive trains, which might be somewhere around 80% when you factor in transmission losses, charging inefficiencies, motor inefficiencies, and so on.
Maybe some day we'll have so much energy we don't know what to do with it, but I think current events are pointing more in the direction of energy getting more expensive rather than cheaper, and whatever means of locomotion requires the least energy will be the one the masses use if it's reasonably affordable.