Look, I've accomplished it, but I KNOW it's wrong:
After including the work item using the code on the question:
IPendingChangesExt pendingChangesExt = ParentSection.GetService<IPendingChangesExt>();
var workItemSection = pendingChangesExt.GetType().GetField("m_workItemsSection", BindingFlags.NonPublic | BindingFlags.Instance);
var modelType = workItemSection.FieldType;
var model = workItemSection.GetValue(pendingChangesExt);
var m = modelType.GetMethod("AddWorkItemById", BindingFlags.NonPublic | BindingFlags.Instance);
m.Invoke(model, new object[] { selectedWorkItemId });
I've added some new code (those are different functions, ok?) ... this second call will wait for the work item appears on the Pending Changes 'Related Work Items' section, and will change its association from Resolve to Associate 'manually'.
IPendingChangesExt pendingChangesExt = ParentSection.GetService<IPendingChangesExt>();
var model = pendingChangesExt
.GetType()
.GetField("m_workItemsSection", BindingFlags.NonPublic | BindingFlags.Instance);
var modelType = model.FieldType;
var workItemSection = model.GetValue(pendingChangesExt);
var selectedWil = workItemSection
.GetType()
.GetProperty("SelectedWorkItems")
.GetValue(workItemSection) as ObservableCollection<WorkItemValueProvider>;
var availablWil = workItemSection
.GetType()
.GetProperty("WorkItemsListProvider")
.GetValue(workItemSection) as WorkItemsListProvider;
// Waiting for section to be ready to start association
while (!availablWil.WorkItems.Where(x => x.Id == selectedWorkItemId).Any())
{
await System.Threading.Tasks.Task.Delay(25);
}
selectedWil.Clear();
selectedWil.Add(availablWil.WorkItems.Where(x => x.Id == selectedWorkItemId).First());
EnvDTE80.DTE2 dte2 = Package.GetGlobalService(typeof(DTE)) as DTE2;
dte2.ExecuteCommand("TeamFoundationContextMenus.WorkItemActionLink.TfsContextPendingChangesPageWorkItemActionLinkAssociate");
selectedWil.Clear();
Despite the effectiveness of this code, I'm still working for a better solution on running the second method. The 'default value' suggested on comments will not work, because the developer should be able to associate/resolve on choosing a button, only.