The easiest way to deal with this is to see through Adobe's nonsensical nomenclature and disregard for user perspective, their love of paradigms from the dark ages of computing and their insistence that they're not doing anything wrong - that it is YOU, the customer, that does not understand their right to insist on being staid and ignore pragmatism.
"Why "undo" doesn't change layer selection and "step backward" does ?"
UNDO in Photoshop is badly named. It is not an UNDO function. It's a "Let me review how it looked in the previous state." button. That's why hitting it twice shows you how it was just before your previous change, and then swaps you back to your current point.
UNDO in Photoshop should be called "Review/Continue" or something like that. Not UNDO/REDO because that's not what it is.
What's most annoying about this is that Photoshop is about the only app in the world that defaults to this behaviour under the traditional CONTROL + Z combo that everyone else in the world associated with UNDO, and yet at no point do they take the time to explain this... nor provide a simple option to make this shortcut into a proper Undo feature.
And Review/Continue is actually a really useful feature for something like image processing style editing. So much so that it probably deserves a top tier, single key shortcut toggle, like the Tilde key or something like that. But you won't ever see Adobe admit to having done something wrong, or consider pragmatic changes and options for its users.
"Why can't you display "layer selection changes" in the history ?"
This is Adobe's stubbornness at its height. You also can't easily step through prior layer visibility settings changes if you break their fragile ordering system in the Step-backward feature. And this can be an absolute NIGHTMARE with a big file with many layers.
Why adobe doesn't get spammed about this problem ?
Adobe is in a near complete monopolistic situation of the graphic design market. How they came to that can best be described by saying they bought all advertorial, editorial and advertising throughout the design industry through most of the 90s. Through the 2000s they exercised this monopoly and ultimately bought out their sole remaining competitor, who was already struggling. They've since killed off the two best of breed products that competitor produced: Freehand and Fireworks. They've created a "user forum" and "bug report" system that deliberately hides and obfuscates all problems and issues with their software as best as they can, and there's no coordination of designers elsewhere to commentate on their activities and critique their products in an honest manner.
To start a rival product is a major endeavour, but not impossible. Fighting Adobe's hold on the media and actually getting positive press for a great design product under their tyrannical control of the endemic media is, however, almost impossible. Only Autodesk could do it, and they're in a different market. And probably don't care to bother. And have some of their own issues...
How in the world adobe developers are not annoyed themselves by this
problem when they use their own product ?
There is zero indication Adobe's developers use their own products. This is not uncommon, the world's of graphic design and programming are not otherwise connected.