Quantum many-body theory for electron spin decoherence in nanoscale nuclear spin baths