If you do not separate this logic from the hero class, how will you control it, for example in cutscenes, in which input is not taken into account? Will you simulate key pressing?
And the more complex example — what if you want to use the game engine, for example to render the background of the game menu in form of level (with player and monsters, controlled by AI), in which the input is used to navigate the menu options? You will not be able to simulate keys.
If you separate this logic then you can do anything you want.
I will use my platformer again as an example.
During the game, inside the level, the hero is controlled by the keyboard (
video). In contrast, in the main menu, the background is the level with the hero, whose movement is not dependent on the keys pressed, and yet after accepting the menu (ie, pressing the jump button), the hero will be outside the screen (
video). The background in the form of a level is also used in the staff screen, where the hero is moved in another way, also independent of the input.
I would not be able to do it if I did not separate this logic (because after pressing the spacebar, the hero would jump, and should not).