The thing that really makes it seem like nonsense is that the ball was already out of play behind the goal when the ref blew and pointed to the spot.
If the ref stops the game for the decision I can understand it. But in these instances, the rule should be that the ref can put the attacking...