Is it my age ?
First off, the example shown is *not* "comparing a variable with itself", it's returning the result of comparing a variable with itself.
Second off, that's not as crazy as it seems ... I have memories of such tricks being used to stand in for "return 1;" or "return true;" - particularly if you want to obfuscate assembler.
Thirdly (although it is BAAAAAD) practice, bear in mind that in some situations/languages, referencing a variable can actually run code (which could change the value of something somewhere).
All of that said, part of writing good code is it should make intuitive sense, which doesn't really apply in those 3 situations