Complex sentence: All palaces built before, were destroyed every time khans either rebuilt, or built a new one.
Split into simpler sentences: All palaces built before, were destroyed. Every time khans either rebuilt, or built a new one.