At the million volt level of lightning, insulators can become conductors.
Air, for instance, is an superb insulator, but put a few tens of million volts across it and it will conduct.
The heating effect is caused by multiplying Volts by Amps to get Watts.
The behaviour of lightning when it strikes is sometimes bizarre.
Which is why all sorts of equipment ( e.g aircraft) are tested in a lightning test chamber.