So every once in a while when a player is landing on a planet, something can happen that will corrupt the planet file. This has presented itself such that when attempting to land on that planet again, the game will freeze during the re-generation process.
So I was inspired to write a script that checks if a planet file is actually valid before attempting to load it. Surprisingly it worked relatively easily!
So now if a planet file has gone bad, the game will reject it and generate a brand new planet for you. You will see this message when you load the planet:

This will still cause some less serious issues. The new planet may have different things on the surface, but should more or less have the same basic properties. So if it's a frozen planet, the new one will still be frozen. But if there was a cave in a particular place, that cave may longer be there.
I am concerned this may lead down a path of many more issues and potential bugs, but I think those will be better than the game just freezing and refusing to load a planet. The previous solution for this issue was to manually delete the planet file and load a new on anyway, so at least the process is automated now.
I have a feeling I will need to refine this script a bit, but so far it's doing what I intended. I hope it helps!