I've had this happen only once in more play-throughs than I'd like to admit to having done (10+) and since that time was the only time I treated Jaheira differently at the end of Act II/beginning of Act III (and I was able to prevent this from happening again by going back to my usual "routine" with her), here's what I'm *pretty* sure is happening:
This is most probably related to "using" Jaheira at the very end of Act II like you would any other companion. My "fix" is to recruit her after the Myrkul fight, send her to camp and then leave her alone until you make it to Rivington/Act III.
What I had done differently that one time I got the "not an ally"-glitch:
I recruited her as usual during the after-party and told her to meet me at camp, but then I did a long rest before actually leaving Act II and before that final Gith fight on the way out of the map. I'll usually go without any long rests between the assault on Moonrise and leaving Act II to make the most out of those Shar/Mystra blessings. While at regular camp (not the automatic camp the game will put you in when you leave the map), I put her on active duty to re-class/re-spec her - then took her off the team again to go back to my regular team-composition.
After I had done the Gith fight, left Act II, done the whole Prism thing and arrived at Rivington, I put her on the active party again and *then* the glitch reared its ugly head. Weirdly enough it only seems to happen when you're in the world, not when you're at camp.
So my guess is that she somehow glitches out if you either put her in the active party while still in Act II and/or if you re-class and/or re-spec her during that time. I didn't test all those different scenarios (took me long enough to undo the glitch by going back to an older save), so I cannot be 100% sure what *exactly* causes this. But seeing how I was able to "fix" it by picking her up and then completely ignoring her until I made it to Rivington, I'm pretty sure that *one* of the things I described above (or a combination of them) is/are what causes this glitch to happen. Plus from what I heard from other users, they too would only get this behavior if they had used Jaheira in some fashion (other than as an attached party follower during the Moonrise battle) prior to making it into Act III proper.