I don't think you're lacking anything! You didn't quit. Be proud of yourself!

You psyched yourself out. As someone who does that herself in stressful situations, I see the signs. I can almost see the little devil sitting on your shoulder, telling you you're going to fail.

I wonder if the pep talk you got from your teammate before the race made things worse? It sounds like he planted the seed that you would be mentally dropped. I'm sure he was just trying to help, but once that comment was out there, you were "dead".