Self-organization by topological constraints: hierarchy of foliated phase space