This is more or less what the realists like Mearsheimer were saying about NATO expansion for twenty-five years, just without all the rhetoric.
We left Afghanistan for the same reason the British and Russians did. We lost. Nobody wanted the war in Ukraine from a policy standpoint, but once it kicked off in earnest, supporting Ukraine was a no-brainer from an interests perspective.
Between 2014 and 2022, the US sent Ukraine something like three billion in military and economic assistance. That's not chump change, but it's also a drop in the ocean of a $50 billion annual budget. For perspective, in FY 2020 we sent Jordan almost five times as much, and sent more to places like Egypt, Ethiopia, Nigeria and Kenya than we sent to Ukraine.
That doesn't look like deliberately provoking the war in Ukraine to me. The war there was a predictable consequence of US policy, but if the US had intended to start it we would have prepped for it a lot harder than we did.