Invalid SQL is generated upon multiple joins of a table
I'd be happy to look into this, but I'm not digging through all the craziness.

If you can produce a *minimal* example using simple models (e.g. my favorites are "User" / "Tweet") I'll reopen and investigate.
I have strange problem with **peewee (v3.13.3)** when joining several tables in **Postgres (v12.2)**.

- DB structure SQL: https://gist.github.com/intruder777/f36a00b2009a1c9a8236c9f641819556
- DB models (generated by pwiz): https://gist.github.com/intruder777/18b800e3758df471d50fdf52cd05ef87
- Python run file: https://gist.github.com/intruder777/74477ace9d7df218f5f43c7368cd8c2b
- Output with traceback: https://gist.github.com/intruder777/8186e40dcf0a7cec4db4569bc1f63165

If I comment out line 27 in `run.py` - it works and generates valid SQL, but if I keep that line it generates invalid SQL.
Those files mentioned above are also attached:
[code_to_replicate_the_issue.zip](https://github.com/coleifer/peewee/files/4539593/code_to_replicate_the_issue.zip)
