Are greyhounds and horses aware they are racing, are in a race or are they responding to training stimuli and surprised that others are there as well?
Greyhounds and horses are likely aware of something like the concept of a race - get there first, or outrun the one next to you to avoid the danger. This is particularly true for greyhound races which involve chasing something.
So from a very real perspective, especially the greyhounds may realize that they're trying to be the first to the rabbit, even if they know or understand that the rabbit itself is not real, this is instinctually wired.
But do they realize that the entire point is that we care, for its own sake, which of them gets there first? Not because they could eat something or escape something but because faster means something about them? It seems doubtful that they could hold such a concept. Especially not in the extremely bizarre world of a circular race around a track that went nowhere, you have to abstract a lot of things to understand the point of that. Even moreso the idea of crossing an imaginary line that represents the finish of the race.
Obviously that's a very non-scientific answer.
Still though, the emphasis on sexual purity in religion is so bizarre to me
It's manipulation. High control groups or individuals need you to see yourself as unworthy to get you to submit to control. It's not just religion, but abusive spouses and friends as well. If they can get you to question your own judgment, or see yourself as deeply flawed, you're more willing to accept their control. Abused women often have exceptionally low self-esteem, many times even thinking that they deserve the abuse.
One way to get you to see yourself as deeply flawed is to ask you to do something that you cannot do. Have no "impure thoughts", believe something you have no evidence for, etc. Deny your body and mind completely. Your inevitable failure to do this proves to you your unworthiness and helps the control group get you to submit to control. It keeps the meme propagating.
Masturbation is also fixated on for the same reason. If you could just sit in a corner and masturbate and be happy, you wouldn't need religion to tell you who to bomb.
I've linked discussion on this point, time coded to start at the relevant section:
I time coded this one as well, for a segment that talks about the parallels between controlling manipulative people and the same techniques used in religion. He highlights that self-worth is needed to escape these manipulation techniques.