We have been seeing this issue not only with first Last Of Us game but with most games with a companion. In most cases, the companion will be ignored by the enemies while the main character takes all the heat.
Well, Naughty Dog is looking to do something a little different with The Last Of Us 2 as the developer acknowledge the issue and added that they are hoping that they would be able to address it in the new game. The idea is to program the companion so that they are more stealthy and will not be spotted by the enemies.
We have not seen it in action yet but the developer seems to think that they have struck the right balance between the companion staying way out of the way and them moving ahead of the player.
The new Last Of Us Part 2 is set to be released on the 21st of February 2020 for PS4.