O.C. 269:1 (Sefaria translation in English):
It is the custom to recite Kiddush in the synagogue, however, the one who recites does not taste the wine of Kiddush but gives it to a minor to taste because Kiddush is recited at the place where the meal is eaten. From the outset this custom was established for the sake of [communal] guests who eat and drink in the synagogue, so that they may fulfill their obligation. And today, even though [communal] guests do not eat and drink in the synagogue, the custom remains.
Why are we concerned about giving the wine to a child? If the person making Kiddush in shul does not fulfill his obligation of saying Kiddush because it is not said where the meal is, what would be the problem by his drinking the wine? He would still need to make Kiddush when he went home! Is there some other prohibition or restriction that I'm not seeing, here?