I'm with John: always carry a couple of spare valve cores, and always carry a core removal tool and/or at least one core removal cap. Note that if you hire other people to change out your tires, they'll often take your caps when they do so, replacing them with useless plastic caps, hence the need to also carry a removal tool in your standard tool kit.
The cost is minimal (couple of dollars per bit and less than an ounce/28 grams of weight total). The convenience if you're way up a gravel road in the mountains alone when your valve core suddenly gives up the ghost--as has happened to me only once--is incomparable.
In theory, reputable shops always give you a new valve core when they change out a tire or tube. In practice, maybe not; in the Developing World, never. By the time you've put on a lot of miles and changed tires a half-dozen times, that valve core might be terminal. Worth thinking about.
Hope that's helpful.