Every time an incident like this happens, we have people chiming in saying or implying that the rules say a player must be immediately disqualified if they hit someone else on court.
This is not actually true, but it's so often repeated by fans and commentators that people think it is. Let's see what the rules actually say. Relevant sections:
N. ABUSE OF BALLS
Players shall not violently, dangerously or with anger hit, kick or throw a tennis ball within the precincts of the tournament site except in the reasonable pursuit of a point during a match (including warm-up).
Violation of this Section shall subject a player to fine up to $20,000 for each violation. In addition, if such violation occurs during a match (including the warmup) the player shall be penalised in accordance with the Point Penalty Schedule hereinafter set forth.
For the purposes of this Rule, abuse of balls is defined as intentionally hitting a ball out of the enclosure of the court, hitting a ball dangerously or recklessly within the court or hitting a ball with negligent disregard of the consequences.
Q. PHYSICAL ABUSE
Players shall not at any time physically abuse any official, opponent, spectator or other person within the precincts of the tournament site.
Violation of this Section shall subject a player to a fine up to $20,000 for each violation. In addition, if such violation occurs during a match (including the warmup), the player shall be penalised in accordance with the Point Penalty Schedule hereinafter set forth. In circumstances that are flagrant and particularly injurious to the success of a tournament, or are singularly egregious, a single violation of this Section shall also constitute the Major Offence of “Aggravated Behaviour” and shall be subject to the additional penalties hereinafter set forth.
For the purposes of this Rule, physical abuse is the unauthorised touching of an official, opponent, spectator or other person.
The player shall be penalized according to the Point Penalty Schedule. This is what the Point Penalty Schedule mandates:
S. POINT PENALTY SCHEDULE
The Point Penalty Schedule to be used for violations set forth above is as follows:
FIRST offence: WARNING
SECOND offence: POINT PENALTY
THIRD AND EACH SUBSEQUENT offence: GAME PENALTY
However, after the third Code Violation, the Referee in consultation with the Grand Slam Chief of Supervisors shall determine whether each subsequent offence shall constitute a default.
In cases of a particularly egregious offense, the chair umpire or tournament referee
MAY choose default the player (section T of the code). So this is and always has been a judgement call; as it should be.
Rulebook:
https://www.itftennis.com/media/2495/grand-slam-rulebook-2020-f.pdf