My son has bouts of vomiting like once a month early morning only after waking up after hours of being asleep. CT head at ER normal xray abdomen showed excess poop this morning he woke up again and only vomits either yellow mucus or bile then after he is

Cyclic vomiter. This could be a neurologic issue like cyclic vomiting, which can present in kids and behaves this way. Stool retention is a problem for many kids but rarely triggers this pattern of vomiting. Review this pattern with your doc and consider seeing a Pedi GI person.
Constipation. Chronic constipation can cause other melodies due to back up pressure including bloating, sense of fullness, vomiting etc. constipation is under diagnosed and undertreated. Pl use OTC Miralax (polyethylene glycol) in recommended doses and follow up with your physician in a couple of weeks. Feel well!