Perhaps you mean the cases when there is a hidden rectangle to which the hero sprite is attached. The hero can have many different animations, run attack jump, etc. And in order not to set up a different collision mask on each frame of each animation, we do this hack.
This makes the work of building levels in the game more predictable, but this is one of the methods, you don't have to repeat it.