Non-Discretionary Spending

Tell me again why Social Security, Medicare, and Medicaid are labeled as “non-discretionary” spending. As I understand it, Congress could shut them all down tomorrow if they wanted to. Or they could cut benefits massively. Or change eligibility requirements any way they like. Which makes it discretionary, doesn’t it? Isn’t it basically just a lie to make it out like the government might or might not spend money on highways, but just has to fork over checks for knee replacements? This has always confused me. Is there some principled basis for the discretionary/non-discretionary distinction that I’m obtusely missing?