BUG: Fix ManyManyList->removeAll() when filters are applied to the query

In order to be cross-database compatible and support filters, the IDs to
delete must be retrieved in a sub-query.

The sub-query cannot be joined to the table in the deletion target due to MySQL locking issues. As such, a bit of query fiddling is needed.