Rising debt-servicing costs are complicating plans in many countries for more military and climate spending.