I would extend what you are saying with companion structures that feed stuff in part of the cortex (encoders) and reads related states out (motor drive in the prefrontal cortex)
Note that in babies there are phases of babbling (same thing in motor movements) where random pattern explorations are input to motor drives are paired with related sensory inputs. In fact, there are massive feedback loops between body sensors and motor drivers that are trained at this point.