Transformers Use Causal World Models in Maze-Solving Tasks