Let's assume that a new party member, already possessed by an intellect devourer, is true polymorphed into a dog by the wizard as part of his initiation ritual (and a big message that said "don't mess with me").
What would happen to the intellect devourer and/or the possessed member? Keep in mind
The intellect devourer initiates an Intelligence contest with an incapacitated humanoid
The intellect devourer is also forced out if the target regains its devoured brain by means of a wish.
If the new member regains its brain, the intellect devourer is forced out, but the wish part makes me think that spells like regenerate won't work on restoring the brain, since technically it's a "complete" creature, not a limb. And true polymorph doesn’t regenerate parts, it literally changes the creature into another creature or object.
While inside a creature, the intellect devourer has total cover against attacks and other effects originating outside its host.
True polymorph originates from outside, but it affects everything inside and outside the target. Also, dispelling true polymorph reverts the creature to its original state with all its equipment. This might mean that the intellect devourer might be consider equipment and be absorbed, but there is this part where the intellect devourer is acting as its brain, giving the new member the status of a creature and maintaining the body alive (it is no different from a zombie, I guess).
By spending 5 feet of its movement, the intellect devourer can voluntarily leave the body, teleporting to the nearest unoccupied space within 5 feet of it. The body then dies, unless its brain is restored within 1 round.
So, keeping it as RAW as possible, what happens? Is the intellect devourer treated as an object and absorbed and, if it's absorbed, does the original regain control while polymorphed? Is it expelled? Is it treated as a single entity therefore the true polymorphed creature is still the intellect devourer on a “new host”?