They’re a fire risk but have you tried fossil fuels and power lines? The newer battery technologies have significantly minimized the heavy metal needs and especially the sodium-ion batteries really reduce the fire and explosion risk.
People use gas generators, though, and it’s not like you have to go back further than my grandfather’s lifetime to have factories or other industrial buildings with oil/coal plants on-premise or directly powering machinery. Pollution and logistics pushed away but we didn’t start with a pervasive power grid.
They are fire/explosion hazards, heavy metals, etc.