That's a bummer. Hasn't happened to me, fortunately.
The problem is that anybody arriving after you has no idea when you will return, or if you even need the charge. I know this wasn't true in your case, but as we've seen on these forums, many people plug in just for fun when they don't need a charge; and the cars are often left for hours - so that's why the second car doesn't know what's going on. Some cars have indicators that help, but on the Tesla there is no indication on the car of how low the battery is, or whether it's even charging at all - plus you don't know how far the owner is going. There is just no way for the new arrival to tell without some hints from you.
It was not courteous for them to unplug you and I don't recommend people do that; but it's also not courteous for us to tie up a scarce and critical resource for an indeterminate amount of time so that other drivers have to guess about whether we need a charge or not - I'd sure hate to call a flatbed to take me to a charger far away and then find out the other car was done charging, or that they live 5 miles away and were just "testing" the charger. The only way to avoid this problem is to use a charging card so that other cars will know your situation. I always put up a card that says whether I need the charge or not, and I have my phone number on it. I highly doubt anybody would unplug you without calling the number first (though it's obviously still possible; just as people could siphon gas. It would be unpleasant to have it happen, but it's rare enough I'm not going to worry about it).
A lock is more secure, but I think this is better than a lock. Somebody might call and say they only need to charge for 15 minutes to be able to make it home or to another charger, for example, and I might want to tell them to go ahead. Not that anybody's ever called me (or unplugged me).
cwerdna posted a good card. A much simpler and easier-to-understand one is
HERE, but perhaps that's too simple as you can't say when you will return (and/or when it's OK to unplug). At least they could call you. I've sometimes written my return time on another piece of paper.