Original Paper issue reported: https://github.com/PaperMC/Paper/issues/4272
is leaking access to the actual World object instead of the WorldGenRegion object by accessing world.getStructureManager()
The WorldGenRegion needs to call StructureFeatureManager::forWorldGenRegion(n.m.s.l.WorldGenRegion) and store that in the WorldGenRegion instance and then startsForFeature needs to use that reference instead.
With this bug, main thread blocks asking for a chunk, chunk goes to world generation, world generation then asks for a structure, hits real world object which does a .join on the getChunk to wait for main thread to generate the chunk.
But because main thread is blocked, and the world gen thread is blocked, this dependent chunk can never be completed, resulting in a deadlock and the server crashes.