Fear and anxiety underly many of the behavior issues in dogs. Understanding the subtleties of how fear works can help us prevent and address it more effectively.
First, it's important to understand how fear develops in the first place. Certain things are innately frightening for animals. This is controlled by genetics (by definition, innate refers to behavior that is not learned). MacLean et al. 2019 found evidence for heritability in a number of traits in dogs including fear. Exactly what individuals are innately fearful of will vary from species to species. The sensitivity to stimuli and intensity of fear will vary from individual to individual.
As we know, dogs also learn to become frightened based on their experience. Dogs that have higher levels of innate fear will be more susceptible to learned fear as well because there are more things that are frightening to them in the first place.
The development of conditioned fear occurs through the process of classical conditioning where the dog learns to associate a previously neutral stimulus (such as a white lab coat) with an innately frightening stimulus (such as restraint and pain at the veterinary clinic). If we want to get technical, the lab coat becomes a conditioned stimulus (CS) for the unconditioned stimulus (US) of pain and restraint. Eventually, the CS of the lab coat comes to produce conditioned fear, which is the conditioned response (CR). The context that the US occurs in can also come to produce the conditioned response. In this example, the veterinary clinic itself can trigger fear, since that is where the pain and restraint are occurring.