I just fixed the following problem:
Fixed: first item in single selection IupTree was not showing that it is selected.
This may have lead you to think that the node was not selected. Actually the SELECTED_CB callback is not being called because the node was already selected.
After understanding a little more of what you were trying to accomplish I can say now that the SELECTED_CB callback is not the recommended way of dynamic filling the braches of a tree.
You should use the BRANCHOPEN_CB callback. But that callback will not be called if there is no children on the branch. So you will also need to add a dummy item that will be removed once you actually fill the branch. This also solves another problem of your script that shows the unfilled branches as empty branches.