Brazil refused to join today as well.
Brazilians hate Trump, and now view America much more negatively thanks to Trump.
In that context, Trump had the brilliant idea of publicly endorsing a candidate in Brazil he personally liked. As anybody who is not a moron would have predicted, that backfired, and the other guy won even though Trump's candidate was leading the polls before Trump endorsed him.
This is common sense: countries get pissed off if some other country--especially the USA--tries to meddle in their election and their collective response is usually, "fuck you!", and they vote for whomever the USA would like the least. This is a natural human instinct and the US would do the same if (say) the president of China endorsed a candidate here.
And then there's the fact that Trump went through this exact same scenario in Canada, whereby his endorsement flipped the polls to the other guy.
It shows you the degree of mental decay among the administration when they can't grasp that voters in other countries might be nationalists too, just like themselves.
A happening before B does not imply causation. Trump endorsement may not have mattered.