Compositional Foundation Models for Hierarchical Planning