I don't really understand why landing a geosurvey team makes a planet/moon/asteroid automatically a colony though.
The answer is a computer science one. Basically, the way Steve wrote the code, the scientists/team have to be somewhere, i.e. in a "location". A ship is a location, a colony is a location, but a planet is not a location. So when you killed the colony you killed the bucket that held the team and the program didn't know where to go. I different way to think about it is that Steve misnamed "colony" - he should have called it "planetary location". In order to put something on a planet you have to create a planetary location. If you delete the planetary location while something's still in it, bad things happen - either the stuff (like factories) goes away, or it goes into limbo.
The bug here is that Steve isn't preventing operator error. The fix would be something analogous to what windows does if you try to rename a word doc that you're in the middle of editing - it says "can't move while the file is open" and refuses to do what you just told it. Similarly, Steve could put in a check that you don't have any teams on the colony when you try to kill it. The problem with that is that his likely to miss something else that will have the same effect (like "move to" orders in a ship) and then we'll get the same errors.
John
PS - I just reread your post. The answer to "why landing a team ..." creates a colony on the moon was that it was an enhancement that people requested. In the old days you had to create a colony by hand before giving orders to land a team on a body - the computer would do the check " is there a colony present" and refuse if there wasn't. This was a pain in the butt, so Steve set it up so that a "land" order would automatically create a colony under the covers.