1) He thought [that] they were guilty.
Here, we have a matrix clause and a content clause. The verb of the matrix clause is "thought". Its subject is "he" and its direct object is the content clause. The verb of the content clause is "were". It's subject is "they" and it's subject complement is "guilty". An optional "that" functions as a subordinator.
2) those who(m) he thought were guilty.
Here, we have a relative clause modifying "those". The words that remain the same between these two examples also retain their functions. The notable difference is that "who(m)" takes on the functions of both "that" and "they". Additionally, it relates the matrix clause which contains it to the pronoun "those".
Here who(m) is subject of the content clause functioning as complement of thought:
Where I said "direct object", this says "complement". Disregarding that, "who(m)" is the subject of "were", and "who(m) ... were guilty" is the argument of the verb "thought". That is to say, "who(m)" serves the same job in 2) that "they" serves in 1).
it is not subject of the relative clause itself but of a finite clause embedded within the relative clause.
What we're regarding as the relative clause is a matrix clause. It's the clause with the verb "thought". The subject of "thought" is "he", not "who(m)". "Who(m)" is a subject, but it's the subject of "were". In other words, "who(m)" is not the subject of the relative clause, but rather the subordinate content clause. That is, of course, an embedded finite clause.
In this construction there is variation between accusative whom and nominative who.
Some people use "who", some people use "whom". That's variation. 'Nuff said.
There is something that isn't said. Not one part of that CGEL passage claims that the relative pronoun is not a part of the relative clause. What is says is that it does not act on its own as a constituent of that clause.
Here's where you've gone astray: the relative clause is not simply "he thought". The clause "he thought" does not exist in this example at all. Those two words are the two words of the relative clause that are not also parts of the content clause.
The content clause is "who(m) ... were guilty".
The relative clause is "who(m) he thought were guilty".
The content clause is embedded within the relative clause.
The "who(m)" attaches the entire relative clause to the pronoun "those". It can't do that if it's buried behind the subject and verb of its matrix clause. If we bother to use it at all, we bring that word (or, as in the case of pied-piping, the smallest constituent containing it) to the front of the clause, which conveniently places it next to the word to which it relates.
As it is not the subject of the relative clause, it also happens to be optional:
those he thought were guilty
Expressing the relative clause as a contact clause, however, simply isn't relevant to the choice between "who" and "whom". Rather, it's relevant to avoiding the choice entirely.