The "emit" command calls the same event on each of the tiles in the room being entered. Most of those tiles aren't holes, so the event is simply ignored, but the hole tiles all have "on hole_count do", and so each of the hole tiles on screen handles the event separately. In turn, they all increase the "holes_left" variable (shared between them as all variables in pulp are global) by 1 to give a total number.
When a play walks into the hole item, the "on collect do" part is triggered for that particular hole, which decreases the holes_left variable by 1, and changes the tile to a "white" tile instead of a hole.
As the "enter" event is applied to all tiles in the room automatically (according to the docs), I think you could change the hole's "on hole_count do" to "on enter do", and remove the "on enter" block in the player script, but haven't tried it.