Hello,
according to explanations found on the internet, this expression comes from the comparison between buttocks and onion, which are (supposedly) seen as having the same shape...Then came the easy association between onions and shallots... Today, "mener une course à l'échalote" is used to describe people trying to reach the same goal, as quikly as possible, and by all means. It has generally a pejorative sense, and more particularly in the sense of a kind of "immature" behaviour. I don't know if I'm really clear, but for example politics, during an electoral campain are often described as "menant une course à l'échalote".
Hope it helps (at least a little)
Munarose