For T5750, we need a CompositeQuery which can walk a single cursor across a collection of subqueries. The goal is to end up with an object which works something like this and produces the expected results:
$results = id(new CompositeQuery()) ->addQuery(new PeopleQuery()) ->addQuery(new ProjectQuery()) ->executeWithCursorPager($pager);
This is complicated to build and requires at least some infrastructure cleanup. Concretely, it's currently not possible to implement getPagingValue() for a query like this, because the result (which is really something like "cursor material", not a "paging value") depends on which direction the cursor is iterating.
On the other hand, implementing this without being able to implement getPagingValue() seems like a dead end that will saddle us with weird limitations. In particular, I think it's a requirement to allow a CompositeQuery to be embedded inside another CompositeQuery rather than arbitrarily restricting them to be 1-ply deep.
More broadly, most paging/order/cursor code in Query subclasses is not robust, and many of the methods related to paging are confusing, too general, not general enough, generally don't make sense, etc. It's unclear how much work this needs.