Pattern → pattern is not how cortex works.
That is a deep learning thing.
There is a cluster of local functions at the mini-column level (see below) but at a higher level the main function of cortex is pattern completion / recognition. These patterns are both spatial and temporal. A closely related function is to signal novelty with bursting - this feature is signaled to subcortical structures to draw attention to lack of pattern recall.
A significant part of the function of the cortex is to learn these patterns for subsequent recall.
There - that’s all there is.
The subcortical structures are able to use this to do all the cool things cortex does.
It takes some reflection to see how cortex does it, but this is the same way that the forebrain forms patterns to guide motor drivers - pattern completion. (Still spatial and temporal patterns)
How does those driver patterns get into forebrain? Watch a baby babbling patterns into her body. The reward functions are in the subcortical structures, not the cortex.