Yes, you are correct, the ID cannot be computed at load time in that situation.
There is a limitation that controls that use dynamic content behavior need to have an ID that is available at compile time.
For example, for this page:
EMPTY DIALOG
EMPTY DIALOG
If you look at the corresponding .java file, you'll see a method:
public int getComponentForId(String id) throws NoSuchComponentException {
if( "dialog2".equals(id) )
return 3;
return -1;
}
That method is used when dynamically loading the control content into the server-side control tree. At compile time, when that .java file is generated, the ID "dialog2" is available, so it would be possible to dynamically load dialog2. However the ID of the first xe:dialog is not available at compile time (it will only be available later at page load time), so the getComponentForId method which is generated at compile time cannot handle the ID for the first xe:dialog control.
The controls that use dynamic content behavior are Dynamic Content, In Place Form, Tooltip, Dialog and Mobile Application Page.