If you took a newborn animal and completely isolated it from its species, would it be capable of assuming a fight or flight distance preset by its species, due to their being no basis for what could harm the animal?
It probably is somewhat genetic. A good example is pigeons. When you approach them, they turn their back to you so that if you get close enough they can escape / fly away. I'd be surprised if this is only a learned behavior, but I also note that pigeons who have been fed let you approach to a closer distance than other birds, so in this example a distance is not completely hard wired.
Such behaviors are more likely a combination of learned and genetic, especially as the animal becomes more complex (has a larger brain). This is a major concern of 'ethology'.
I think few inherited behaviors are completely inflexible.