The spell mighty fortress is very specific about the size and shape of the castle it makes, but not about where walls are connected. Both are 120' square areas with four 20' turrets connected by 80' walls, but the second one you get more interior space and can access your turrets without leaving the outer walls.
Update: We finished the campaign last night on Friday the 13th (9/13/24). We all got out alive, with the majority of our loot, from the 23rd level, at level 19 (334411 XP 😁), but opted not to fight Halaster in the condition we were in.