Perhaps I'm missing something in the original question, but this seems to all work as written, as far as I can see.
The last paragraph of the intellect devourer's Body Thief ability says:
If the host body drops to 0 hit points, the intellect devourer must
leave it. A protection from evil and good spell cast on the body
drives the intellect devourer out. The intellect devourer is also
forced out if the target regains its devoured brain by means of a
wish. 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.
The host body can be assumed to still be a living, breathing creature, since the text of the Body Thief ability states that it dies only after the Intellect Devourer leaves its skull. That suggests it is a perfectly valid target for a touch-delivered spell - in this case, the spell is never being cast on the Intellect Devourer, but is instead cast on the host body, driving the Devourer out.
This does, however, bring up an interesting issue of how a brainless living shell can be "willing", as per the description of the protection from good and evil spell, but that's a different question...