A highly seasoned, well-respected practitioner asked our massage & bodywork group to describe what might have caused her to experience pain and protective feelings following her abdominal surgery.
It seems most likely that they resulted from the pain and trauma memory she experienced before and after the procedure when her anesthesia wore off.
In such cases involving surgery, or most any other tissue-nervous system insult, the pain she experiences is not just "caused" by her brain.
What actually occurs is the insult to her nervous system that happened at the site, stimulates receptors to send action potential signals which go to her spinal cord (SC), which sends signals to her thalamus, which distributes the signals to other areas of her brain. The signals that are received by her brain are then interpreted.
Health care has been well aware for over a century that other factors can influence your brain's signal interpretation. Chiropractic and Osteopathy's main principles since the 1800s clearly embraced the Health Triad, which acknowledges that many other factors influence our brains' interpretation of pain and other sensory stimuli, which includes biochemical interactions and psychosocial influences both present and past. It's all part of the "wholistic" (holistic) view of health, which is now basically rebranded as the "bio-psycho-social and neuromatrix models."
So although many factors can influence one's post-surgical pain experience (basically, an infinite number of factors can influence it), keeping with a more practical and useful explanation that's in the realm of what we know happens in the overwhelming number of such pain experiences, is this: the surgery damaged (traumatized, insulted) tissue. And surely severed some neurons. That causes these peripheral nerves to send action potential signals where? First to the SC, then to the thalamus, then to areas of the brain. What happens there? The brain interprets the signals. In this case, it most likely and accurately interprets them as "danger and damage." In plain English, it hurts!
So her brain didn't just "make up" (cause, output) the pain as if nothing happened to "cause" it to give her the experience of pain. What happened was her brain simply interpreted the signals, appropriately it seems in this case.
This is why it's common for people to experience pain signaling/interpretation for months and sometimes longer following surgery because it takes time for the tissue/nerve damage to heal and stop sending associated signals that reach your brain.
To further illustrate how such signaling works (which is actually a pretty simple, basic, three neuron pathway), when doctors perform basic procedures such as sewing stitches or millions of other procedures that they routinely do to help facilitate tissue repair and healing, they often inject chemical nerve blocks such as Lidocaine to help prevent you from feeling pain.
How do such nerve blocks work? They block the action potentials from the nerves in the involved area, so the action potentials that otherwise would have been sent are stopped by the chemical interference. This prevents the signals from ever going to your SC→thalamus→areas of your brain where the signals would have been interpreted. Since your brain doesn't ever receive the signals, it obviously doesn't sense or interpret pain.
Arguably, you may experience emotional squeamishness and even translate your dreadful psycho-emotional experience as being "painful." Not to discount that reality, but it's another aspect aside from the neuro-physiological one we're talking about now.
While it's been well known for 150 years that you can experience pain as a result of other factors besides tissue damage, that does not negate the fact that perhaps the vast overwhelming "cause of pain signaling" is from some sort of tissue damage. Or from another aspect of what happened to you, which is––an inflammatory response.
Inflammation is almost always a cardinal response to surgery and most other traumatic insults, and often results from neural impingement syndromes that we see daily in our practices.
The inflammatory chemical constituents can and often do irritate neural receptors, which once again send signaling to your SC→thalamus→other areas of your brain→where it is interpreted.
Another common sequela to surgical and other such tissue intrusions, involving more severe and prolonged inflammatory responses, is fibrotic adhesion formation. These adhesions often adhere to tissues and neurons in ways that can impede movement, circulation, and cause "pain signaling" to occur. This is why so many people are affected by post-surgical adhesions causing them to "experience pain," especially abdominal ones because of the depth and extent of richly innervated tissue damage.
Of course, all of these physio-neurological reasons and causative factors that "inspire your brain to interpret pain," are influenced to some degree by whatever psycho-emotional factors might also be affecting you. For example, people who were violently attacked and cut by a knife will perhaps experience over time more residual post-traumatic fear and pain than someone who experienced a larger incision done by elective surgery.
You can think of the neuromatrix and psychosocial pain models in relation to the former Gate model, being somewhat analogous to Einsteinian or Quantum physics in relation to Newtonian physics, which doesn't really dismiss Newtonian physics, but instead, adds a more expansive understanding.