Why is this not just:

    new_rsc_ref = create_xml_node(set, XML_TAG_RESOURCE_REF);
    crm_xml_add(new_rsc_ref, XML_ATTR_ID, obj_ref);

New items always get added to the end