Here's a POC script I made to test the limits of dynamic map generation.
On each level load the script will assemble the parts found in MAP01.wad into a map that makes sense (i.e. all parts are used and areas are matching).
Terminology:
1. Fragment — a single section/prefab; closed group of sectors
2. Area — a semi-closed group of fragments (may have connections to other areas)
3. Fragment portal — a line of certain size (width x height) and texture (TPLAREA# where # is 1-6). The line is converted into a line portal, so it must have empty space behind.
Fragments will be connected by fragment portals with matching areas. This allows making areas behind key doors, as illustrated in the sample.
Modes:
1. Static portals mode (currently default): will move sectors around physically and rotate them
2. Dynamic portals mode (can be switched by setting GENERATE_STATIC_PORTALS to zero): will create simple teleporters
Limitations:
- Dynamic lights are broken if two sectors occupy the same 2D space as a result of static portal linking (caused by GZDoom)
Supports:
- Slopes
- 3D floors
- Rotated / scaled surfaces
I believe even without fancy sector features this is already great for a nice gameplay experience, but I can't see myself mapping anything complicated anytime soon, so I'm releasing it as a resource and not as a level

This code can be reused freely with or without credits and you don't have to contact me about it (MIT)