I think the bug in corridor corner fix was caused by a wrong call order of routines which made all corridor walls look like corners! Simply calling transform terrain first seems to correct most bugs in that area, as this new screenshot shows:
Still the problem is how to connect rooms to caverns (thick corridor here). It could be nice to avoid too many connections so it means checking cavern areas with flood fill to see if they are connected. Tiles not connected would be listed so you would need to go through them and check for room walls or nearby corridors to join them in the level structure from one (or more) points to avoid hacking away all room walls (if there are a lot of cavern areas around rooms).