Make fflib_QueryFactory.toSOQL deterministic

Porting work from FFDC Story#18316 - make fflib_QueryFactory.toSOQL deterministic to open-source apexlib.