What you are suggesting is almost exactly the same as an episode of Night Visions entitled "Patterns" as per Name of a movie where a guy is committed to a hospital because he sees patterns in everything and has to make gestures so that the world doesn't end
A psychiatrist, Dr. Dan Critchley, arrives at the mental health hospital he works at and is informed by his secretary that his wife's plane flight is due to arrive at six-thirty p.m. She also tells him that there's a police officer waiting in his office with a new patient, Martin, who was arrested the day prior for attacking a man in a park.
When Dan sits down in his office with Martin, he notices that he keeps indulging in what appear to be various obsessive compulsive tics, such as repeatedly folding and unfolding a piece of paper or repeatedly touching his right ear lobe.
After some discussion, Martin explains that he has a contract with God and that he has to perform these rituals in order to prevent bad things from happening. Each ritual must be performed a specific number of times for a specific purpose; for example, one keeps fish in the sea while another prevents planes from crashing. Martin see patterns all around him that let him know which ritual needs to be performed at which time, and believes that through the sum total of his rituals, he's holding the world together. However, he's had to devote more and more time to these rituals over the years, at great cost to his personal and professional life.
Having seen no proof, Dan doesn't believe any of this, and insists he can cure Martin of his compulsions through a combination of behavioural therapy and medication; he plans to start medicating him right away. When Martin hears this, he becomes agitated, so Dan calls in a couple of orderlies to restrain him, injects him with a drug to calm him down, and has him placed in isolation.
Later, Dan has finished work for the day, but as he's heading out of the building it becomes increasingly apparently that things around him are going haywire. A car in the parking lot is upside down, fish are falling from the sky, and people are doing bizarre things, including killing people and setting cars alight. Dan realises that Martin was telling the truth, and that if he doesn't resume his rituals quickly, the plane Dan's wife is due to arrive in will crash.
Dan rushes to the cell Martin is being held in and tries to get him to resume the rituals, but Martin is still high on the drug he was injected with and doesn't care anymore. Dan frantically attempts to perform the ritual that prevents planes from crashing himself, asking Martin if he's doing it right; he then receives a call from his wife, who informs him that her plane almost crashed but that everything's okay now.
As Dan is rushing back into the office, he passes his receptionist, who has indeed hung herself at her desk (following image depicts that suicide).
Click to enlarge
According to Phillip Levens, the writer of the episode, this was an original story, not based on a prior short story:
Warners Bros asked me to meet with the producers, and they asked me to write an episode. It was inspired by my own OCD that I had as a boy.