This isn't exactly a direct answer to my original question, but I came across a work-around at this site: <
Essentially, the author grouped the corners into four pairs, and then instead of trying to put corner cubies into their correct tetrads, he goes further and puts them into their correct pairs. The author claims that this condition is stronger than the cube having the correct "tetrad twist", so it is sufficient to exit phase 3.
I coded this in my own implementation, and it seems to work perfectly.
Would still like to know what tetrad twist actually is though :)