It's strange though, if you switch that sentence round ("I'll do the work by this evening") it sounds much more natural. Perhaps it's because it's like a promise here ("I promise you, I WILL do the work by this evening!")

On the other hand, if you switch around your second example like this, it doesn't work. "She'll graduate from university by the time he comes back from prison" still definitely sounds wrong.

Every time I think about the English language too much, it's like a massive mindf**k. I use the grammatical rules every single day, and yet I don't actually know what those rules are! Whenever I try to explain a grammar rule to a non-native English speaker, I feel like I'm rationalising the rule to myself more than explaining it to them.

All I can really say here is to always use perfect tenses when you're talking about "by X time". That way, you definitely won't go wrong