Is there a difference between 'They all had done something' and 'They had all done something'? [duplicate]

So, I preparing for this test and one of the questions is this. test screen shot

The teacher remarked that they all had done it very badly.

Why is this sentence structure wrong?

I found this question in English learner stackexchange that expands more on the position of the word all in a sentence.


(CoGEL 5.16 p. 258) […] All and both can occur after the head, either immediately or in the M adverb position (after the operator, cf 8.16). For all and both we have, then, the following possibilities:
[…]
They were all accepted.
?They all were accepted.

The symbol "?" in CoGEL means that native speakers are unsure about the acceptability. This means then that "They had all done something" poses no problem of acceptability, whoever reads or hears it, but "They all had done something" might sound strange to some native speakers. This is reflected in this ngram (duplicated below).

enter image description here


Clarification on the meaning of "operator"

(CoGEL 2.49 p. 80) The definition of operator as first auxiliary raises the question of what happens if the corresponding positive declarative has no auxiliary, and therefore no operator. In such cases, the verb "DO" is introduced as a "dummy" auxiliary to perform the function of operator.

More specifically, the operator is that auxiliary that is selected as a reference for the placement of the negative particle and the changes in the positions of the subject when forming negations, questions and negative questions.

  • The ship may have been sunk. — The ship may not have been sunk. — May the ship have been sunk?

  • They came yesterday. — They did not come yesterday. — Did they come yesterday? — Did not they come yesterday?