Topological expansion of the Bethe ansatz, and non-commutative algebraic geometry