So I am going to do something foolish and wade into this issue. Your specific two questions are:
How can I avoid inadvertently offending my female peers and getting into trouble for it?
and
How can I avoid committing an equivalent faux pas in an academic environment, such as an international conference?
These really are two different but similar questions. There are also deeper dimensions to this problem, including the issue of how both professors experienced themselves.
Let us start thinking about how Professor X may have experienced the question of "what floor?" I grew up in a place that still had one elevator operator when I was very little. I also used to spend Saturday and Sunday morning watching old movies and old television shows from probably age 8 to 18. I have seen more very old movies that I could probably count and I still watch them. I watched many American and British movies and television shows.
Professor X, who is both British and 75, would have spent about half of his life not only seeing this joke live in the real world, but watching on television and movies. This was more the case after the operators vanished. This is because humor is about a disconnect between the speech and the environment. I could probably find an Academy Award winning movie with that line in it. I certainly could find principal comedians who have performed that line.
It is quite possible that the professor who said the joke was trying to make people feel more comfortable with an old silly joke. I am bringing this up because, assuming neither the original speaker or you are a predator like Harvey Weinstein, if you do this faux pax it will likely be with positive intent or without thinking, but no ill will.
In academia, there are multiple levels to this issue. It is possible that this professor is a predator, though there appears to be no evidence of this anywhere. The specific problem in academia is that it is common for there to be only a handful of academics specializing in many fields. In this case, Professor X is not only a principal academic in his field, he is faculty at two Ivy's and Oxford. This professor is powerful. This professor may not experience himself as powerful, but just ordinary.
Now let's look at Professor Y. Professor Y may be too young to even know what an elevator operator is, probably never saw the mountain of movies that used it as a gag, and was American. Professor Y may or may not know their relative power position, but believes that some consequence for the action taken should happen. We do not know the personality of Professor Y, nor do we know their views on punishment, appropriate conduct, or Professor Y's cultural experiences.
Professor Y is also trying to act appropriately. Not only is Professor Y offended, but feels the need to protect other female academics. Professor Y also appears to be acting in good faith.
This is the problem with this type of situation, it is really only a problem if both parties are acting in good faith. If Professor X was a predator, this report may have caused other reports and some of them may have caused dangerous revelations to come to light and we would not be discussing this. Likewise, if Professor Y had a habit of being litigious it would become known within the community and she would probably begin to be ignored. That is a problem though, still, it is what people do.
For the second question regarding an international academic conference, the simplest is don't tell jokes. When I was an undergraduate an international student from Japan gave me a book of jokes and I didn't find many funny and I found some extremely offensive. I didn't tell him I was offended, but I did explain that an American wouldn't find these funny. Furthermore, humor is conditioned on the culture. The Three Stooges wouldn't be considered funny anymore, indeed, there would probably be Twitter attacks on them.
Nonetheless, you could easily do a non-humor based faux pas in an international setting. Cultural rules on food, clothing, body positions, and so forth are extensive and contradictory. Americans regularly give the English their equivalent to "the bird," without meaning to or even any idea that they are. The best solution, if you believe you have offended someone, is to flat out apologize. You can explain you were unaware of the perceived meaning and that you will try and be careful in the future. Unless you step on a taboo and seriously cross a line, most people will laugh it off.
Professor X crossed an American taboo and it is a new one. I don't know the professors involved, but I would expect neither of them foresaw the results or feel they are really in the wrong. If you break a taboo, you probably cannot fix it. Both of them probably broke taboos, actually.
The old rules of civility, particularly English, would have both of them talk it out and try and "make nice," to use the older phrasing. The fact she went straight to a formal complaint violates the society's actual rules, but also probably the older English norms and customs professor X values.
The most you can do is try and be civil whenever possible. Of course, as mentioned above, Professor X was probably trying to do just that.
Now as to female academics, that is a slightly different question. I am presuming you are in the United States. If you are not, then nothing I said applies.
For starters, the social rules are changing very fast in the United States. Indeed, much of the political unrest is that some parts of society have decided to hold onto older rules while other parts have tossed the older rules and have adopted new ones. Two women could easily offend each other if their operating version of the rules are different. In fact, I have seen that happen. I know of two female academics that are at loggerheads over what are differences in generational perceptions of appropriateness. There are also power issues as one is a full professor and the other an assistant professor.
Still, I would like to point out a study.
Files J, Mayer A, Hayes S, et al. Speaker Introductions at Internal Medicine Grand Rounds: Forms of Address Reveal Gender Bias. Journal Of Women's Health . May 2017;26(5):413-419.
Now, as a disclosure, I find this paper problematic on methodological and statistical grounds. There are three specific issues that should have been addressed in the editorial process, in my opinion.
The first is that there is a disclosure issue. Incomplete disclosures are not unique to this paper and plague many fields, but I find them troubling. The second is that the inference may suffer from Yule's paradox and so either the inferences should have been greatly restricted or cautioned, or not done at all. The third is that they had data that they didn't use, most likely for reasons of cost, time and the fact they likely didn't know it would matter, but which could have flipped the inferences to the other direction.
With those disclosures, let me provide descriptive information from the article which bears on this discussion.
The paper is from data collected from video recordings of internal medicine grand rounds. The speakers were physician and researcher peers with MD, PhD and MD/PhD qualifications.
In professional dyads, women introduced other women as doctor 97.8% of the time. Men introduced other men 72.4% of the time. I bring this up because I would be willing to bet that the same female physicians don't stop at stop signs 97.8% of the time. That is an incredible level of social conformity for any group. It implies it is very important to the group. Being called "doctor" and calling someone "doctor" is quite important to women.
Men, overall, only introduced a person as "doctor" 65.6% of the time with women doing so 96.2% of the time. Men introduced women as doctor 49.2% of the time.
There is a lot more going on here, but if you drop the inference of implicit discrimination, it still says a lot about the four sex groupings.
For women, explicit signs of respect are important and the joke could have been interpreted as that she was less than he was. You never joke downward. If you are powerful, relative to another group, you don't tell jokes about that group. With women, the fact that they are engaging in a behavior at such a high rate says it is important to them.
For men, on the other hand, being introduced as "doctor" is not of particular importance. One could infer, at least enough to investigate whether it is true, that men have other sources of power in addition to their degrees. As such, the title means less. Since it means less, they use it less. You could actually argue that in a meeting filled only with doctors, the title could be dropped entirely. That the formality is present implies that someone with power or a group with power feels that it should still be used at a high rate.
I am interested in this line of research for a couple of reasons so you will understand the advice I am going to give you.
The first is that I am rarely addressed as either "doctor," or "professor." I noticed this very early on, while other people are always addressed by title or with the title preceding the name. Because I am curious, I have been counting this and I have been addressed by title six times in the last four years.
The reason I noticed it was it is disconcerting sometimes for me to be addressed as "mister," by individuals who seem to have forgotten that I am a "doctor." However, as I have performed research in two completely different academic fields, I viewed this as a research question. "What triggers people to use titles?" It may help you here.
It also isn't that I am doing minor work. I just submitted a paper to a conference with the conjecture that there is an entire branch of stochastic calculus that nobody noticed. If correct, its effects could impact things ranging from particle physics to the social sciences. Still, I would be willing to bet money that if the paper is accepted, I will be introduced using my first name in its diminutive form "Dave."
Because my first research field was in industrial psychology and we performed field observations of seventy-seven teams in the field over a period of many years, I became proficient and tracking who spoke to whom, the nature of the content and word use and word choice. So I started, informally and without an IRB as I am not publishing, paying attention to academic language use. I saw some professors addressed as professor one hundred percent of the time. It was the personality characteristics. They were so formal as people, even when not working, I couldn't imagine addressing them by name without a title. Others, like me, were so laid back that they were rarely addressed by title by anyone.
To avoid offending anyone, female or male, listen to them. I did observe that several female colleagues expressed views that formal shows of respect were important to them. Although they didn't say it in those words, if you listen, you will hear it. Sometimes the best way to find out what matters is to shut up. Consider this my permission to you to shut up.
You should avoid jokes in general with colleagues that are not your friend. I have a fellow academic who is female that I usually stop by and say good morning every day. Her office is on the way to my office. However, on the day after Donald Trump was elected, I told her that I would have to stop going to her office starting January 20th. With the new rules of appropriate behavior, I expected her to come by my office and to bring coffee. She would also have to say good morning to me before I would say good morning to her given her reduced status for the next four years.
With good friends, you can usually joke. Still, you should be careful. Jokes are associated with pain and sometimes that pain is personal.
The best way to avoid offending anyone is to remain in a formal emotional stance until you know how they want to be treated.
You are going to offend people in life, see the advice above. Spend time being considerate, listening and showing respect. Then they will forgive you when you remind them that despite their doctorate, they should be bringing you coffee now that we have new rules. With some friends and in some environments, that joke will fly. In others, it will not. If they know you care and respect them, people will forgive you your faux pas.