Teams that are behind in score generally send their goalkeepers up front for a corner kick/set piece in the last seconds of the game.

Why are GKs not being sent up front when the result is a draw and the time has expired and it’s clear that the set piece/corner kick will be the last action of the game? The captain could surely confirm with the referee that the corner kick will definitely be the last action…

Is there a rule that prevents the referee to calling the game while the goalkeeper is in the opposing box or are teams just too scared that the ref will allow a potential counter attack?