Note the key difference between the two acts.
When giving [seemingly endless] foreign aid to Ukraine, we are spending OUR taxes on ANOTHER country. (and one that is pretty corrupt to boot!)
When we build up the military, we are spending OUR taxes on OURSELVES.
Sheesh. It's not THAT hard to wrap your head around.
But I do partially-sorta-kinda agree with you on one aspect of your meme. The government, for the most part, has a bad habit of wasteful spending.