I think this is a valid question. If the defender closes gates on attacks, he should not be able to capture heroes. It is a big flaw in the game mechanics that makes this possible. Evony reps was on the forum saying you can lose your hero even by farming NPCs. Which proves how little they know about their own game. Glitches and "little black holes" in their system makes heroes run away sometimes too. It's stupid, and they wont change it. Simply because heroes are the main reason someone coins. If you lose your best hero on any server, you might consider starting over on a new server.
In the end this is all about money and BAD BAD BAD programming and customer service.