Unless I am just not understanding what you are saying, I'm guessing you have set the transform of some object as the parent of another object (child object). When you remove the object that is the parent, you have the children trying to access a transform that no longer exists. You can either temporarily change it via SetParent() to something else, then change it back, or even better - just dynamically change the button info instead of removing it and re-adding it. Or, you could add them all at once, and keep some hidden, and shuffle them around (make active/hide) depending on what the user is doing.
Cheers.