Object insert popup shows categories when no instances under it can be inserted

Categories in the object insert popup always display even if no instance under them can be inserted.

Expected behavior
Categories should only display if one or more instance in that category can be inserted at the time.