Why does having a single market price maximize quantity traded? From what I have heard, the exchange of goods defined by the intersection of supply and demand generally maximize quantity traded, although this doesn't apply in cases of monopolies, imperfect information etc. I am trying to understand why this is true, and came across what appears to be a counter example:

There are 4 people in a market for eggs, 2 buyers and 2 sellers. The buyers are each willing to pay up to \$10 and \$3 for 1 egg each. The sellers are willing to sell an egg each at \$9 and \$2. The most productively efficient trades are when one egg is bought for some price between \$9 and \$10 and another is bought for some price between \$2 and \$3. What happens according to supply and demand is that one egg is traded for a price between \$3 and \$9.

The fact that there is one price seems, in this case, to reduce the total traded quantity. What am I missing?
The competitive equilibrium price does not necessarily maximize the amount of goods produced. (The answer to your actual question ends here.)

What the competitive equilibrium price does is reach an efficient level of production. Any situation where the production level differs from the equilibrium level is Pareto-inferior to the equilibrium. This means that starting from the competitive equilibrium, you can transfer money from some of the market actors to other market actors in such a way that everyone will be better off than in the situation with non-equilibrium production levels.

In the example you gave buyer 1 (reservation price 10) and seller 1 (reservation price 9) have a collective surplus of \$1, and buyer 2 (reservation price 3) and seller 2 (reservation price 2) have a collective surplus of \$1, meaning both pairs 'feel' they gained \$1 by trading. But in the competitive equilibrium, buyer 1 and seller 2 have a collective surplus of \$ 8. If they give buyer 2 and seller 1 one dollars each, everyone would still be more happy than in the other situation. So the second sale is in some way inefficient.

A single price is not necessary to achieve Pareto-efficiency, for example first degree price discrimination yields the same results.