It’s certainly a legitimate concern, @evetype, but I assure you that once evolution happens, most pokémon tend to calm down. Your togepi’s wanderlust is actually a trait most of its species experience in varying degrees, and it’s directly related to togepi’s natural curiosity. Once it evolves, the bond between togetic and its trainer takes precedence over any remaining curiosity it has, and thus, it will be more inclined to stay put.
For the most part, anyway. It’s certainly true that this is a generalization and that there are togetic who still feel strongly about wandering, especially if their trainers did not travel much. If you notice that your togetic is still prone to wandering after evolution, there are two things that you should do.
First, be sure that she’s in an up-to-date poké ball that’s linked to both your pokédex and your storage system account. You can track her using either your PC or your pokédex, should she somehow break free.
Second, the above will only work if she also has an implanted chip. Many trainers of pokémon capable of flight make it a point to chip their pokémon, and the procedure itself is both harmless and performable at any licensed pokémon center. Simply take your togetic (or even togepi, as the chip will not harm a pokémon undergoing evolution) to your local Nurse Joy and ask for a chip to be implanted, and she’ll walk you through the rest once the procedure is over. Typically, the whole appointment involves not only the implantation but also the syncing of the chip to your trainer accounts and pokédex, as well as a national database of pokémon. That way, no matter where your pokémon is, she can be found, identified, and—eventually—brought back to you.