This is a newbie and probably a lame question but it popped up while I was reading the design doc: https://svn-archive.torproject.org/svn/projects/design-paper/tor-design.pdf
If theoretically someone runs a modified onion relay (OR) that does not really extend the circuit (section 4.2 - Constructing a circuit) but instead computes the next key and responds as it has extended the circuit as a real OR does. It seems that the user (Alice) does not make direct connections to the next nodes in the circuit but relies only on the entry node to extend it. Once she make a request through that OR, the OR will know details about her and the final endpoint and thus compromise TOR.
What does TOR to ensure that traffic is actually relayed through multiple nodes and not just passing through a single node that seemingly act as a normal node?