So, would it make sense for Ukraine (when this is all over), to rebuild their electrical grid and put it underground or otherwise protected? Or is that not really possible?
I think you have to define what you mean by "electrical grid". The wires? Nope. TomTX hit on the efficiency issues, and besides, suspended power lines are (relatively) inexpensive to run and repair. The substations, transformers, etc? That may make more sense to locate in more protected areas.
That's still kind of a bad idea, though, because either
A) Russia gets kicked out of Ukraine, the war ends, and Russia stops trying to blow it up, or
B) Russia eventually runs out of long-range precision weapons that can hit those facilities, or
C) Russia somehow wins (how!?) and it's a moot point.