I mean... you can use solar panels to generate the electricity the EVs use while plugged in. The big advantage is they can be installed near to where your car is charging, completely bypassing the transmission network. The other big point is that solar is intermittent, so you'll often need to pair it with batteries, and those help a lot with a bad mains grid.
Also, battery chargers in general (whether grid battery, home battery or EV chargers) represent a huge dispatchable load that can be scaled up or down more or less freely, which lets you avoid blackouts by turning off demand instead. That just shifts load around, so they're obviously going to need to build more capacity either way, but having lots of dispatchable load available makes the grid both cheaper and more reliable if you take advantage of it.
I'm not trying to say that powering every vehicle in your country by electricity is trivial, because it's not... but it's a lot easier to keep the lights on when a big chunk of your load is battery chargers. Especially if you can run the lights from the batteries.
they also consume a shitload of electricity
At an average of 12000km/year and 0.2 kWh/km, an EV is about 6.5 kWh/day, or equivalent to a ~275 watt constant load. I don't know if I'd call that a shitload. To give a sense of scale, the US generates 35 kWh/day/person (or ~1.45 kilowatts) of electricity.
Of course, India currently generates only ~3.9 kWh/day/person (~160 watts), but only about 4% of them currently even own cars; if they were all electric it would average ~0.26 kWh/day/person which is only about a 7% increase in their total electricity generation. (About 20% own motorbikes or mopeds, which use much less energy than cars. That's another advantage India will have, if they can keep two-wheeled vehicles the primary transport mode at least until they're done electrifying.)