First of all, carefully read this: JSTL in JSF2 Facelets... makes sense?
Summarized, EL expressions in id attributes are evaluated during view build time. In your particular case, based on the symptoms, the #{cc.attrs.pubId} seems to be available during view render time only, for example because it's definied by var of an iterating JSF UI component, or because it's definied as a bean property which is set after view build time only, etc.
You need to head to a different solution. I can't tell that in detail as you didn't tell anything about the concrete functional requirement for which you thought that this would be the solution. But, to the point, you've 2 options:
Make sure that any EL variables in id (and binding) attribute are available during view build time. For example, use <c:forEach> instead of <ui:repeat>.
Put it on a plain HTML element. It's evaluated during view render time.
<rich:popupPanel id="popupEditor">
<div id="#{cc.attrs.pubId}">
...
</div>
</rich:popupPanel>
Or perhaps you don't need it at all and you simply overthought a solution without actually having a concrete problem. When your composites are designed properly, you should have no need for a dynamic ID inside the composite.
<rich:popupPanel id="popupEditor">
...
</rich:popupPanel>
JSF already takes care of it automatically as composite components inherently extend from NamingContainer. You just have to give the <my:composite> itself a fixed ID instead.