A child's (or an adult's) nervous system may detect danger or a threat to life when the child enters a new environment or meets a strange person. Cognitively, there is no reason for them to be frightened. But often, even if they understand this, their bodies betray them. Sometimes this betrayal is private; only they are aware that their hearts are beating fast and contracting with such force that they start to sway. For others, the responses are more overt. They may tremble. Their faces may flush, or perspiration may pour from their hands and forehead. Still others may become pale and dizzy and feel precipitously faint.
This process of neuroception would explain why a baby coos at a familiar caregiver but cries at the approach of a stranger, or why a toddler enjoys a parent's gentle embrace but interprets the same gesture from a stranger as an assault. We can see the process at work when two toddlers encounter each other in a playground sandbox. They may decide that the situation and each other are safe if the sandbox is familiar territory, if their pails and shovels have roughly similar appeal, and if they (the toddlers are about the same size. The toddlers may then express positive social engagement behaviors - in other words, they may start to play.
"Playing nice" comes naturally when our neuroception detects safety and promotes physiological states that support social behavior. However, pro-social behavior will not occur when our neuroception misreads the environmental cues and triggers physiological states that support defensive strategies. After all, "playing nice" is not appropriate or adaptive behavior in dangerous or life-threatening situations. In these situations, humans - like other mammals - react with more primitive neurobiological defense systems. To create relationships, humans must subdue these defensive reactions to engage, attach, and form lasting social bonds. Humans have adaptive neurobehavioral systems for both pro-social and defensive behaviors.
What allows engagement behaviors to occur, while disabling the mechanisms of defense? To switch effectively from defense to social engagement strategies, the nervous system must do two things: (1) assess risk, and (2) if the environment looks safe, inhibit the primitive defensive reactions to fight, flight or freeze."
Source: The Polyvagal Theory: Neurophysiological Foundations of Emotions, Attachment, Communication and Self-Regulation by Stephen W. Porges