It's actually exceptional writing, the equal to an adult drama, if you don't parse tiny segments of it out of context instead of analyzing the writing of the film as a whole.
Like most of Pixar's films, this works on numerous levels that will appeal to all audiences, and the film's premise will be illustrated succinctly when you see young children embody the emotion of pure, carefree joy and laugh at scenes their older siblings or parents are tearing up at, because they've got that greater experience and understanding of the need for grief as a coping mechanism, to bring loved one's together over a shared loss or disappointment, or as a cathartic release.
Young kids won't get all the subtle nuance of the film, but they'll still enjoy it for the vibrant colors, the amazing visual craftsmanship of the world of Riley's mind and the fun characters inhabiting it (and brief visits to the minds of her parents and during the credits, other people and even dogs and cats in a great sequence). There's a great running gag about how an irritating commercial jingle becomes an earworm to everyone in the film, one that might actually end up becoming an earworm to viewer's of the film as well.
There's genuine heartfelt loss and sorrow in the film, dealt with in a mature way that's not typical for most children's films and which perfectly illustrates the Pixar philosophy of not pandering or talking down to children. Trek fans will be intimately familiar with the themes as they've been dealt with in Trek films before (TWoK and TFF), namely confronting and not cheating your way out of grief, and how you need your pain because it helps you to learn and is part of the wealth of experiences that define you as a person.
Joy in the film is unabashedly played up as the chief protagonist at first, but we find out (as does she) as the film goes along that her desire to suppress sadness, to both literally and metaphorically keep it confined in a circle that represents bottling up our feelings and putting on a happy face, is not a healthy or mature response, and can lead to acting out in dangerous ways (like running away), lashing out at people, or in loss of friendships and interests, which is depicted in a rather amazing yet terrifying way as the cities that represent the primary elements of Riley's personality begin crumbling away into the abyss of her subconscious.
Michael Giacchino's music alternates between the whimsical, poignant, and harrowing with the same deft precision he always employs, using his favorite instrument, the piano, to good effect.
The casting is perfection, especially among the emotions:
Joy: Amy Poehler from Parks & Rec
Sadness: Phyllis Smith from The Office
Disgust: Mindy Kaling from The Office and The Mindy Show
Fear: Bill Hader from Saturday Night Live
Anger: Lewis Black from The Daily Show
The parents are well played by Kyle McClachlan and Diane Lane, and there's an imaginary friend named Bing Bong, played by Richard Kind, who plays a large part in the middle of the film and gives us one of the film's more touching scenes.
If it's not already obvious, I can't recommend the film highly enough. It's among the better films of the almost always great Pixar pantheon, and it can be enjoyed by adults, young kids, and older kids alike on multiple levels. "A+".