Yes and No.
Certainly some double standards, but one is looking after his physical health, which is much easier to see than mental health is.
I'm not an Osaka fan, but respect her decision to pull out of the French, but she was trying to change the rules right before and during the French Open when it comes to the players requirement to speak to the press, whereas Federer simply stepped away due to injury.
Vastly different scenario, and hopefully Tennis takes Osaka's stance seriously and begins to allow the players to NOT be required to speak to the press.