Learning that two things always go together. The child's reaction of fear to a dog is normal since some dogs may be dangerous and it is best to learn caution. In time, provided the child meets friendly dogs and is not bitten, the automatically 'conditioned' fear will die away. Since this fear results in avoidance of places associated with these reactions, there is no reason for the phobia to get better. Introduce him to a more gentle dog.
Agoraphobia usually starts with panic reactions coming 'out of the blue'.
They are more likely to happen when alone or away from home. These reactions tend to be associated with the particular places where they happened, even if this was just by chance at first. This conditioning leads to avoidance of these places which tends to become a habit. A mental disease like schizophrenia. Due to physical illness.