AFAIK, there is one possible ways to cleanly solve this: change the DOM structure of the whole dropdown to nest all the options into their groups.
The current solution with empty groups might work to pass test but probably won't cut it for assistive tech users' experience.