Learning Cognitive Maps from Transformer Representations for Efficient Planning in Partially Observed Environments