There is a horse at my barn like that!!! When I tie her up to eat (she is an outside horse only so no stall) she pees!!! And there is another horse, everytime you put her in her stall, she pees. No matter if she just peed 4 minutes ago outside, she will pee in her stall EVERY time you put her in there.
I think this is truly a "marking" thing. When we put hay out, the "lead" gelding will pee immediatly on his pile of hay, the others won't go near it after that.
I think it is like marking territory like a dog does, "my stall", my hay, etc.