In Flaubert's novel, domestic mediocrity drives his heroine to 'dreams of luxury'. The novels centers on the heroine's disillusionment at not having a higher status in society and being trapped in an unsophisticated provincial town. Emma Bovary rebels but never strives to separate herself from society. Emma doesn't mind being a wife; she just wants to be the wife of someone important and wealthy who moves in high society. But, convention means that she cannot escape her marriage without being cast out of good society. Death presents an escape, and seems to offer her a way to fulfill her romantic fantasies. Yet, her death is painful and grotesque, which could be interpreted as the heroine's punishment for flouting social norms.
Incidentally, my first introduction to this French novel was Posy Simmonds' graphic novel titled 'Gemma Bovary' — a wonderful parody of Flaubert's tragic tale.