Issue #17901: fix TreeBuilder construction for an explicit element_factory=None

Based on report and patch by Aaron Oakley.
Issue #17812: Fixed quadratic complexity of base64.b32encode().
Issue #11995: test_pydoc doesn't import all sys.path modules anymore.
Try to make test more reliable (saw some sporadic failures on buildbots)