Unity hung, and after rebooting my terrain is missing, and my script crashes trying to access terrain.terrainData. Presumably the terrainData was corrupted when I rebooted.
I’ve got a web package I built shortly beforehand, is there any way I can extract the terrainData from that and restore it in the editor?
Almost impossible. A webbuild can be unpacked, but the data format is not documented. Also Unity doesn't support importing this format so it would be alot HEX-dump-crawling and if you identified and extracted the data in some way you have to find a way to bring it back into Unity. Probably just create a new terrain of the exact same size / properties and try to exchange the data in the asset database.