In a series of deals over the past three months, lawmakers rejected some of the president’s most aggressive attempts to whittle down the government.