The answer is yes, the game is hard coded to avoid giving penalties against the AI. However, and I think this is the important aspect many people forget, this was at its core added due to fan requests.
The AI have been gifted advantages in their own box since PES 2017, and this has steadily increased since then. The issue stems from the fact that in PES 2016, despite being an exquisite game of football, one common complaint from fans was that it was too easy. It wasn't, it was a difficult game for the vast majority, but the problem that Konami (and any developer of a football game) has is that if you build the "perfect" football game, with no input lag, pixel-perfect control of players, and completely fair AI, then the top level players will eventually absolutely master the game to the point where they cannot lose. In PES 2016, top players that played the game for hundreds of hours could easily get to a level where they were literally playing like Messi with every player, dancing through the AI in the box with frightening precision and creativity. The problem we have today is that AI in a football game, if all elements are fair, can never match the level of a top player, because football is fundamentally a game about creativity. It doesn't matter how well you programme the AI, real players will execute passing and dribbling moves/combinations that the AI simply can't handle, as was the case in PES 2016.
In PES 2017, the response to the lack of difficulty for top level players was to give the AI more freedom to aggressively challenge the player in the box. The problem with that is, if you simply make the AI more aggressive in the box, top level players will be winning multiple penalties every single game. In order to balance this, on the top difficulty (superstar back then and now superstar and legendary) the ref has been toned down substantially for the AI in the box. This is still the case in PES 2020.
I agree that this is not ideal, but I am not sure what the solution is. Removing this would make the game too easy. FIFA 20 does not have this for example, and even on the highest difficulty (which increases AI player stats) you can absolutely destroy the AI consistently without challenge. The exact same was true of PES 2016, I remember going through invincible seasons in Master League on superstar towards the end of that game's life cycle.
I am hoping that on next gen, AI will improve and the challenge of the game will increase as a result without having to artificially aid the AI. I do think we will always see things like this in the game however; otherwise it will always be too easy for the very best players.