As with almost any intelligent animal, Thoroughbreds are a product of their breeding and environment. We run a cattle ranch here in the western U.S. and have, at any one time between 8 and 20 horses. They are smart, durable little cow ponies, some with a Thoroughbred in their DNA background. They are, however, mixed breed "mutts" in many cases. After observing horses for many years and listening to the "old timers", I've come to understand that horses are first and foremost "herd animals".
It would take more room and time than available here to discuss "herd dynamics", but suffice it to say, race horses (in almost all cases of distance racing they're Thoroughbreds) are "hot blooded" (whereas our cow horses are "warm blooded") meaning their temperment can be skittish. This is mostly due, however, to their environment and handling. Breeding for only one characteristic, running in this case, can be detrimental to other traits.
So, to your question. "Wrong situation" covers a broad spectrum of what could happen. But it is deffinitely a fact that the breeding of the animal will be the least of causes in aberrant behavior as you describe. It will, be, however, primarily due to the horse trying to establish their place in the herd, with the other "herd animals', be they human, dogs, goats or other horses. Generally, the horse will signal any attack, but these can be subtle and the handler would require experience in predicting such a move.
Long way of saying, the horse could, but it would be unlikely and it would not solely be because of the horse being a racehorse...