Because, yes, dogs are aware of heights and can be afraid of them, just like people.
They can even tell how big another dog is by the sound of its growl.
However, a dog's relative size doesn't matter as much in the doggy world as attitude and personality does.