I think this is a bug. There were already in v15.
My speculation about why this occurs:
If your complex profile has different skin heights (as your case now), the actual wall thickness in frool plan depends on the actual ’Floor Plane Cut Plane” position.
The 2D and 3D script in window and door object taking into account the different ways the thickness of wall.
Workaround 1:
Don’t use ‘symbolic’ floor plan representation of door/windows. Instead use the ‘projected’ or 'Projected with Overhead'. But then there will be no 2D swing lines.
Wokaround 2:
Try using composite walls instead of complex profile when possible.
Split the profiled wall into three parts in your case :
1. composite wall for lower floor
2. composite wall for upper floor
3. profiled wall for the profiled brick skin
i7-4770K / 16GB / GTX560 2GB / 512GB SSD / Win10 64bit
AC21 (HUN-64 bit) / Bimx Pro / Revit 2017