I'm not sure that's a reasonable expectation for a random stranger walking in on what they presumably inferred as an important phone call, though I don't know your relationship with your flatmate or if that's something you two have done in the past when need arose.
Sounds to me more like a communication error than anything else, in a situation that was clearly stressing your flatmate out. I'd personally apologize for the miscommunication in an "this was nobody's fault, but we both could have probably handled it better" kind of tone and ask what to do next.
Well yes, that was what I meant by "miscommunication". Either the agent and flatmate didn't understand whether or not they had the okay to enter the room, because OP went straight to work without informing said flatmate, or they Needed OP out of the room and OP was unaware. Not an "asshole" move, but certainly more ambiguous than they could have been about it.
I fully believe with better communication that either OP would have held off on taking a work call, because the agent couldn't enter with them in there, or they would have come in the room even while OP was working.