What does the “Undo” item on your menu run? That’s before the group separator but doesn’t actually appear in the menu outside of Customize mode, so I suspect it’s involved somehow.
The separator is really a property of the item above it, so when that item doesn't generate anything the separator gets lost.
We'll see if we can improve this so it's kept. It's a little complicated if there are multiple such entries in a row but we should be able to do it; just requires some time to work out the logic.