[1.7.x] Fixed #22476: Couldn't alter attributes on M2Ms with through= set