Only use count() optimization if there are no joins

The `count()` helper optimization only works if the current `query.statement` performs no `JOIN`s.
However, if a relation is set to use joined-load, the current `query.statement` will perform a
`JOIN`, and the `count()` helper will return the number of rows in the `JOIN` (that is, the number of objects found for the current endpoint *multiplied* by the number of objects in each joined-loaded relation), not the number of objects that will be returned.