Sterilizing it is an option except that any method we have for that damages the nutrition severely.
Poisoning it (like with liquor or preservatives) also isn't necessarily the best option.
But the other items you listed follow the principle that each of these foods is incomplete... it's a very terrible food on its own, and has to be added to other things to be a proper diet. Microorganisms need to live on top of the thing, not just eat it... they won't take a piece of one and drag it to the other part (like bringing the rice to water or vice versa) so they don't seem to ever touch consume them. Surely in the future you could separate the components from the food without damaging them too badly (eg. condensed milk tastes horrible because it's so damaged, worse than pasteurization).
And one example you didn't list... butter will go bad, but clarified butter takes an extremely long time (not ever scientifically tested to the limit as far as I can tell... maybe forever if produced perfectly and kept out of the sun, cold, etc.). So not just carbs, but fats also can last long. When you clarify the butter, ideally use sour butter which has less/no sugar, and you are removing milk solids, water, etc. so it's the same concept.
Also if you pile enough salt on meat so it soaks right through and sucks out all the moisture (like a whole leg of prosciutto), it lasts enormously long. It only expires quickly after you unbury it or slice it up. And even then, it might just dry up worse and not really rot very fast.
And it'll still break down possibly, but not so much by ordinary life forms. Also as stated in other answers, you still can never be sure since nobody tested such things for a million years. Maybe nothing will be perfect, but a combination of things will be closer than any single method, and close enough for your space voyage.