Hi Avital,
Best wishes!
Quite a challenge you pose, it's absolutely not the standard way Mendix works. The page design is done design time and can be quite extensively influenced using conditional visibilities. So my first question would be: why?
But assuming you have a good reason, I'd like to go a bit on adventure. As you may know, Mendix retrieves the .page.xml and the layouts it uses (see screenshot below), so definitely start off with the same lay-out as you already use. Maybe it's possible to generate such an XML and trigger the Mendix Client Framework to render this as the page layout?
Let me know if this is some direction you'd like to travel.