The idea of a snake granting a woman her enlightenment might literally be the oldest story on the earth. In the Muslim and Judeo-Christian creation narratives, Eve, the primordial woman, is tempted by a snake to "become like a god," by doing something she understands to be wrong. In yoga, the kundalini serpent lives at the base of each human's spine, and it is responsible for deep tantric awakening, which is exactly what happens to the wife in the novel. The wife's experience of out-of-body adventures, heightened orgasm, and feelings of deep power—these are the traditional effects of serpent spirits (in world mythology).
The dilemma of the novel starts as a faulty marriage, as in, "Why am I so unsatisfied?" but after the wife meets her Djinn serpent, she realizes that she has an even greater dilemma: Why has her entire experience of life been shaped by shame? When the snake gives her sexual satisfaction, it's the first time the wife has ever experienced it (which means the marriage is not rooted in mutual connection). Therefore, the wife is a dynamic character who is transformed by her experience of the supernatural, and by the end of the novel, her relationships with herself and her husband have changed. Instead of wanting a better marriage, she wants a better life for herself where women are not oppressed.
In order to make sense of the husband's role in the story, it's important to analyze the symbolic closing of the entry where the snake would come. First of all, it's a metaphor for chastity (covering a hole so a snake can't come in), but the implication at the end of the novel is that the wife is going to invite the snake again. This isn't technically an affair, because the snake isn't sexually involved with the woman, but it does signify the wife's willingness to take matters into her own hands, since her husband is uninterested in her sexually.