In order to leverage a cox model for calculating adjusted survival curve - one must estimate the baseline hazard function. To my understanding this has to be estimated (non parametrically) for observations where all categorical variables are set to their reference category and all continuous variables are set to 0. Then - the relevant HR's can be applied on to the baseline hazard function as appropriate. But AFAIK the KM estimate is done over the entire sample. So how is this gap resolved ?
In practice, it's the baseline cumulative hazard function, $H_0(t)$, that's estimated, and in practice it's not quite done in the way that you state. It's estimated by weighting the individuals at risk at each event time by their hazards. Those hazards are expressed relative to the situation at the reference set of predictor-variable values. That way, you can include all cases in the calculation. See this page among many others on this site.
The approach to getting a baseline or covariate-adjusted survival curve is different from the Kaplan-Meier method, using instead the relationship $S(t)=\exp (-H(t))$ after the cumulative hazard has been estimated.