Fixed #21872: Not detecting dependencies from M2M fields