The project maintainer surely would have not felt bad giving credit to someone ? Exhibiting this kind of leadership usually makes me feel great !
On the contrary, as we see from the article, the lack of credit really did create unhappiness from thin air…
There is no need to try and take explicit credit when you get implicit credit simply from the visibility of leading the project.
Having spoken to a lot of low level leaders I'd disagree. It does create unhappiness because in the end they are no less human. That unhappiness may be worth it for the other benefits and the happiness they gain from them but saying they don't experience unhappiness is dismissing their very human emotions. But often the unhappiness dominates, they burn out and then get replaced by some narcissist/sociopath. That person is fully happy and rises up the ranks.
Of course if you happen to do IC work as well it makes sense to take credit for that, but I think that mixing leadership and IC work tends to result in burnout.