Fixed #21169 -- Reworked M2M RelatedManager.clear() to properly account for default filtering.

Refs. #3871, #21174.
Used simpler queries for m2m clearing when possible.