This is an interesting question and when you said:
when we drive to work every morning we don't sometimes remember the details because we do it so often we chunk those details.
you are talking about two different phenomena. They are chunking and autopilot. As for the theory that:
pattern recognition is rewarded with a release of endorphins
I haven't been able to find anything to confirm this, however I may have found a possible source to the theory that pattern recognition can lead to the release of other reward chemicals in the brain, which can only be very loosely linked with the other two phenomena.
Chunking
Within psychology, Chunking is a method used for remembering things rather than "switching into autopilot" to carry out learned tasks automatically without conscious awareness. Rather than chunking a recognised pattern, we are employing chunking by producing recognised patterns which can be used later on to remember something needed in the future. We are breaking the item to be remembered into chunks and remembering the chunks with the patterns created.
The phenomenon of chunking as a memory mechanism can be observed in the way individuals group numbers and information in the day-to-day life. For example, when recalling a number such as 12101946, if numbers are grouped as 12, 10 and 1946, a mnemonic is created for this number as a day, month and year. Similarly, another illustration of the limited capacity of working memory as suggested by George Miller (1956) can be seen from the following example: While recalling a mobile phone number such as 9849523450, we might break this into 98 495 234 50. Thus, instead of remembering 10 separate digits that is beyond the "seven plus-or-minus two" memory span, we are remembering four groups of numbers.
Autopilot
This has been studied quite extensively and one study on this (Hyman Jr, et al. 2014) talked about how it is possible to drive home and have no conscious awareness during or after the trip. See also, Ira Hyman (2014)
In the introduction it was highlighted that:
There are two broad categories of possible explanations. One possible explanation is that people were aware of the road and obstacles during the drive, but immediately forgot those features. Alternatively, driving without awareness may represent a form of inattentional blindness, in which objects that pass through the focal point of vision do not enter awareness (Neisser and Becklen, 1975; Becklen and Cervone, 1983; Mack and Rock, 1998; Simons and Chabris, 1999; Simons, 2000). People may use visual information to guide the control of actions, but may not devote attention to objects. Without attention, people may fail to bind features into objects (Treisman and Gelade, 1980; Wolfe, 2007) and thus may fail to become aware of the things they pass when driving or walking. This second possible explanation would be consistent with the theoretical claim that visual information follows two pathways after low level visual processing (Goodale and Milner, 1992; Jeannerod and Jacob, 2005; Westwood and Goodale, 2011). One pathway is the dorsal pathway which uses visual information to guide action, enabling someone to grab an object or navigate around obstacles. The other pathway is the ventral pathway leading to object recognition and conscious awareness.
Pattern recognition and release of endorphins
There is a book called Your Money and Your Brain by Jason Zweig (2008) and Michael Angelucci (2011) provided some insights from the book, including:
Dopamine is a chemical that sends energy throughout the brain and turns motivation into actions. Dopamine is so powerful that a rat will starve to death rather than turn away from dopamine. Lay an MRI scan of a cocaine addict about to get a fix next to that of a person who thinks he is about to win money and they are virtually the same. We also know this about dopamine and rewards: dopamine is strongest when a reward is unexpected. That getting what you expected does not produce dopamine, and if the expected reward does not show up then the dopamine dries up. We also know that if the reward is big enough, dopamine seems to have a memory. This last point is huge. Investors who have received a large reward will experience a dopamine release if a pattern similar to the winning pattern is observed. This may result in the investor taking actions that are not sound.
What is being said here is that with addictions comes patterns of behaviour which has rewards. Your remember how you was rewarded by certain behaviour patterns and so you strive to gain those rewards again by repeating that behaviour.
You might see patterns within stock markets or within casino games (see Gambler's Fallacy within my answer to another question). You might get lucky one or two times and win using the pattern, increasing dopamine levels (a reward chemical within the brain) and this enforces the fallacy that the pattern exists and you commit it to memory for later use. But the pattern does not actually exist and therefore when employed later on it fails.
Conversely to the endorphin effect proposed in your question, in this situation, the pain of losing and the stress of trying to find out how this could have happened, will increase endorphin levels and the principal function of endorphins is to inhibit the transmission of pain signals.
References
Angelucci, M. (2011). Dopamine and Pattern Seeking and Your Investments [Online]
http://awmfinancial.com/uncategorized/dopamine-and-pattern-seeking-and-your-investments/
Becklen, R., and Cervone, D. (1983). Selective looking and the noticing of unexpected events. Memory & Cognition 11(6), 601–608.
DOI: 10.3758/BF03198284 PMID: 6669028
Goodale, M. A., and Milner, A. D. (1992). Separate visual pathways for perception and action. Trends in Neurosciences 15(1), pp 20–25.
DOI: 10.1016/0166-2236(92)90344-8 PMID: 1374953
Hyman, I. (2014). The Dangers of Going on Autopilot. Psychology Today [Online]
https://www.psychologytoday.com/us/blog/mental-mishaps/201404/the-dangers-going-autopilot
Hyman Jr, I. E., Sarb, B. A., & Wise-Swanson, B. M. (2014). Failure to see money on a tree: inattentional blindness for objects that guided behavior. Frontiers in psychology, 5(1), 356.
DOI: 10.3389/fpsyg.2014.00356
Jeannerod, M., and Jacob, P. (2005). Visual cognition: a new look at the two-visual systems model. Neuropsychologia 43(2), pp 301–312.
DOI: 10.1016/j.neuropsychologia.2004.11.016 PMID: 15707914
Mack, A., and Rock, I. (1998). Inattentional Blindness. Cambridge, MA: MIT Press.
Miller, G. A. (1956). The magical number seven, plus or minus two: some limits on our capacity for processing information. Psychological Review, 63(2), pp 81-97.
DOI: 10.1037/h0043158
Reproduced in webpage format with author's permission at: http://cogprints.org/730/1/miller.html
Neisser, U., and Becklen, R. (1975). Selective looking: attending to visually specified events. Cognitive Psychology 7(4), pp 480–494.
DOI: 10.1016/0010-0285(75)90019-5
Simons, D. J., and Chabris, C. F. (1999). Gorillas in our midst: sustained inattentional blindness for dynamic events. Perception 28(9), pp 1059–1074.
DOI: 10.1068/p281059 PMID: 10694957
Simons, D. J. (2000). Attentional capture and inattentional blindness. Trends in Cognitive Sciences 4(4), pp 147–155.
DOI: 10.1016/S1364-6613(00)01455-8 PMID: 10740279
Treisman, A. M., and Gelade, G. (1980). A feature-integration theory of attention. Cognitive Psychology 12(1), pp 97–136.
DOI: 10.1016/0010-0285(80)90005-5 PMID: 7351125
Westwood, D. A., and Goodale, M. A. (2011). Converging evidence for diverging pathways: neuropsychology and psychophysics tell the same story. Vision Research 51(8), pp 804–811.
DOI: 10.1016/j.visres.2010.10.014 PMID: 20951156
Wolfe, J. M. (2007). Guided search 4.0: current progress with a model of visual search. In: Integrated Models of Cognitive Systems, ed. W. Gray (New York: Oxford University Press), pp 99–119.
Zweig, J. (2008). Your Money and Your Brain: How the New Science of Neuroeconomics Can Help Make You Rich. New York, NY: Simon & Schuster