Yup. Happened all the time. Both dc. A dr told me it’s a sign of a strong gag reflex as it’s the snot and phlegm hanging about at back of throat and making them vomit - like sticking finger down throat etc. Made a lot worse if they eat dairy when they have a cold - generating more phlegm.
Both also used to vomit if they cried too much - again, snot sitting back of throat.
They do grow out it. And on plus side more than one dr have commented to me that the strong gag reflex is good as it means they are much less likely to choke!
I used to do this, well into my teens (sorry to say for anyone hoping their toddler will grow out of it!). When I got up in the morning, I think it must have been the overnight build up.
My DD has also done this but after a bath when she's bunged up - I think the steam must shift it and as PP have mentioned she has a very strong gag reflex so that may be an element. She was not good at taking medicine when she was small!