How could I make a dimension with custom structures

I don't really know if it's really ethical to ask 2 questions the same day, but how could I make datapack based maze generation using rooms, that I already saved in my datapack? These should spawn back to back to each other, and get chosen randomly. I made .mcfunction to summon armor stands, summon more only on grass and place a structure, but my world crashed every time because of entity amount.
Continue to help post