Grounding higher cognition in sensorimotor and predictive loops