Deadlatches have existed for a very long time, to prevent that problem. Next time you are looking at a door with a latch instead of, or in addition to a bolt, look "behind" the main latch and you should see a small, separate bit protruding. Press that bit in, and then try to push the latch back. The latch shouldn't budge. That's a dead latch.
Unfortunately, while they have been on the market for a very very long time, not everyone uses them, and many that do use them don't use the proper strike plate for their door, or just allow them to go into misalignment. So, the deadlatch doesn't actually get pushed back when the door is closed, and the latch can be carded as though it weren't even there.
Found a good picture, here: http://www.gaterslocksmith.com/images/deadbolts/Deadlatch-bu...
Unfortunately, while they have been on the market for a very very long time, not everyone uses them, and many that do use them don't use the proper strike plate for their door, or just allow them to go into misalignment. So, the deadlatch doesn't actually get pushed back when the door is closed, and the latch can be carded as though it weren't even there.