You say your problem is a very complex mesh, and yet you already solved the minimal topology for your problem, which you embedded in your question. Just model it - below on gifs:
- A default plane, Numpad 7 Top Ortographic Mode, E Extruding, holding ✲ Ctrl to snap to grid.
- ✲ CtrlR Add Loopcuts (right-click to cancel sliding it) to create an inner grid where needed (use mouse wheel to change number of cuts), and K Knife tool to make diagonal cuts.
- Select unnecessary edges and X Dissolve Edges.
What's left is selecting the horizontal edges that are supposed to be elevated, and GZ moving them up:
Those triangles on ends of the roofs probably should be vertical - can be fixed by just moving their top vertices, but for such case the workflow becomes even simpler:
This time I used an alternate method for diagonal edges - GG sliding vertices. Without Auto Merge enabled, I had to A Select all, and MB Merge By Distance.