dude this is a battle manga the whole thing is about battles and fighting. you don't see anybody really associating with anybody else out of the context of the manga.Think back, I mean really think back and just how many times did Kubo ever really show the development of Ishida? Hardly ever. We got rare 3 panel glimpses of training once or twice but never any internal dialogue with the exception of his Dad helping him regain his Quincy powers and just what was the rare dialogue consisting of? His dad pointing out his objective as a Quincy and how helping Ichigo is a technicality. You keep saying friends but Ishida has never canonly associated with shinigami. You barely see him associate with his human friends outside of battling.
if you wanna sit around and pretend like Ichigo, Chad, Orihime aren't his friend and as if he hadn't had a sort of truce with the shinigami that's fine. this ia a guy that put his life on the line for these people multiple times. he even went to SS to help them save Rukia.
there was no foreshadowing of this plot twist. its flat out bad writing. compare this to what just happened in Naruto with Sasuke. that plot twist was slightly jarring but very understandable because of his character development and events relating to his brother. we even witness the moments he comes to his conclusion and why he did.
Ishida? either he's a double agent or we just witnessed a very messy asspull. when you have to justify a character based plot development by saying when well the character was underdeveloped so we don't really know said character when the character suddenly commits an irrational act that's bad writing.
perhaps Kubo will make it up on the back end when Ichigo and Ishida have an confrontation. but it still goes against everything we've seen of him as a character this entire series.