A mobster walks into a psychiatrist’s office.

As many have observed over the years, the basic conceit of “The Sopranos” sounds like a setup for one of those jokes no one tells anymore. But 20 years later, it remains the most famous narrative construct in television, with a punchline that still tests the limits of critical hyperbole.

A mobster walks into a psychiatrist’s office and proves that television can do whatever film can do, possibly better. A mobster walks into a psychiatrist’s office and turns HBO, a premium channel then best known for old movies, into an industry trendsetter. A mobster walks into a psychiatrist’s office and births an era of anti-heroes that will launch all manner of new stories, careers, networks, entire new entertainment platforms. A mobster walks into a psychiatrist’s office and creates a legend.

The legend of Tony Soprano, and the men who made him — creator David Chase and actor James Gandolfini — has been parsed as reverently as “Ulysses” and credited with single-handedly elevating the medium previously known as the boob tube and sending it on its current march to world domination.

As with most legends, time blurs the facts in favor of hyperbole. Those who say with certainty that “The Sopranos” is the “best” or “most significant” show ever clearly don’t watch a lot of television. What often gets overlooked, even by the ecstatic and exacting fans, however, is that there was a psychiatrist in that office, and that psychiatrist was a woman.

But while the series made much of Tony’s women issues — his basilisk mother, his priest-infatuated wife, his mercurial mistress(es), his crazy sister, his frank if overly entitled daughter — none of it is a joke.

Chase has said, most recently in “The Soprano Sessions” by Matt Zoller Seitz and Alan Sepinwall, that what drew him to making “The Sopranos” was the idea of creating a family mob show, one that would appeal to women as much as men.

Not surprisingly, then, it was the women who made “The Sopranos” magic.

The caliber of performances certainly did not hurt — Lorraine Bracco as Dr. Jennifer Melfi, Edie Falco as wife Carmela, Aida Turturro as sister Janice, Annabella Sciorra as the craziest of the mistresses, Gloria, and the magnificent Nancy Marchand as “Anthony’s” mother Livia.

Those kinds of performances, however, do not come unless the writers make the space for the actors to give them. The women of “The Sopranos” were fully realized and full-dimensional.

“The Sopranos” could only be as compelling as the people Tony was trying to appease and protect.

After all, it wasn’t the shootings, beatings, garroting and power plays that were giving him panic attacks, it was his family. Unlike other fictional mobsters, Tony was not interested in going legit; his despair grew from the nagging realization that, like the blue-collar worker, the neighborhood mobster was becoming obsolete. Even the ducks he loved to watch up and flew away.

The men of “The Sopranos” — the embittered and duplicitous Uncle Junior (Dominic Chianese), the loyal if dense Sylvio (Steven Van Zandt), the miserly germaphobe Paulie “Walnuts” (Tony Sirico) — remain faithful to the old ways, happy to provide plot points, exposition, color, humor and a wide spectrum of brutality.

Yes, they were part of the satire that rippled through the show, which sent up male toxicity even as it celebrated it, but it was the breadth and depth of the female characters that made the show, and Tony, different. Who made it real.

It is strange that so many shows that attempted to follow in “The Sopranos” footsteps missed this entirely. The importance of strong female characters seems to be something television writers and executives like to continually discover with, say, the rising popularity of the female characters of “Mad Men” or “Game of Thrones.”

Livia Soprano (based on Chase’s own mother) was miserable, manipulative and murderous. Played by Marchand in the last years of her life, she was also hilarious, magnetic and made a mean baked ziti. Whether by intention or necessity, she provided the perfect foil for a son who famously managed to strangle an informant during a college tour with his daughter.

Carmela was an equally vivid conundrum of forthright honesty and systemic mendacity. She knew what Tony was, but “mob wife” was not how she identified; she knew he was cheating but did not admit it had anything to do with her marriage; she longed for something better, just not enough to give up what she had.

Still, it was Dr. Melfi who saved Tony Soprano from becoming a prisoner of his own genre. Although their initial encounter was something of an extended joke — with Tony narrating in general terms certain career “events” and “situations” that are in fact often violent crimes — Melfi served as a stand-in for the non-mob world, and the audience.

Listening to Tony talk, Melfi was certainly attracted by his personal power and the aura of the mobster, but she remained focused on his basic humanity, fueled by her belief that he was motivated by universal needs — for a loving parent, an honest marriage, an examined life. In the beginning, she believed that if those needs were met, Tony would leave the criminal life.

Whether she was kidding herself is a question for her character and fans of the show. Tony was undeniably, irrefutably a monster, as were most of those who surrounded him.

In the third season, Melfi was raped in the stairwell of her parking garage. It was a powerful, disturbing and controversial episode; rape was not often shown on television, and many felt that this strong female character was somehow being punished, brought low. It also forced Melfi, and to a certain extent, the show, to clearly choose sides.

With a word she could put Tony’s talents to use for “good” and fully enter his world, in which the rest of the show exists. But Melfi said “no.”

And indeed, as Tony slouched toward Holsten’s, Melfi slowly faded from “The Sopranos” narrative; when in the show’s penultimate episode she finally refused to treat him any more, the moment was oddly anticlimactic but very, very telling.

A mobster walked into a psychiatrist’s office and changed television. But despite that psychiatrist’s best efforts, and the richness of the characters around him, Tony Soprano himself could not change. For all his newfound humanity, he was the leading mobster in a mobster story, and his fate had been fixed before she opened the door.