I agree the levelling in terms of mechanics is not roleplaying
Oh, but it is part of the video game genre called rpg. It's just not in the name, as the name was not descriptive, but loaned from non video games.
Role Playing
Role-playing games let you assume the role of a protagonist, customizing their abilities, equipment, and appearances. Through exploration, dialogue, and strategic combat, players navigate worlds, uncover lore, complete missions, and level up their characters.
While that is not an authorative definition and an authorative definition is not really possible anyway, as labels like this can change their meaning, a walking simulator without abilities, equipment and some form of leveling, will be ... oh, I already named a possiblity: such an rpg would be called a walking simulator. Having an avatar run around and tell a story by playing the game, having choices and maybe puzzles is not enough.
One minor, sometimes bigger, part of rpgs is how to optimize your character build. It's just another way of giving the player something to decide. A crucial difference for rpg vs action game, is the separation of player skill vs character skill. If you play an action game, your own skills improve. If you play a rpg, your character's skills improve. Of course lots of games are some kind of mix of both.
I guess it's the immersion thing again. If you let players make decisions, it lets them be in the middle of things.