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

Refs. #3871.