This is a gross simplification, but foods need not already contain the enzymes that digest their own tissues in order for us to digest them. Our salivary glands, stomach, pancreas, and intestines produce the enzymes necessary for digestion, and for some compounds, we depend on gut microbes to do part of it for us after we eat the food--that is, in healthy people. In the case of some foods, we coax microbes into taking a first pass before we eat them, then we eat the results (milk to yogurt; cabbage to sauerkraut, etc.).
Of course, not all people are healthy. Some can't eat raw cabbage, but do fine with cooked or fermented. Some can't eat dairy with lactose, but yogurt is okay.
I believe we attribute these problems not to the foods lacking the enzymes, but rather, to either a digestive system not evolved to eat the food (e.g., lactose intolerant people) or to a faulty digestive system that either cannot produce the necessary enzymes, is compromised by overgrowth of the "wrong" microbes somewhere in the system, drugs, etc. (Alas, my own digestive enzyme production was likely compromised by my long-term abuse of PPIs--which I have kicked, by the way; I didn't need the enzymes in the food itself, I needed my own enzyme production to return to normal.)
In the case of fermented foods, microbes produce the enzymes they need to break down the foods. In cabbage, microbes digest the sugars and produce lactic acid, giving sauerkraut its tang. It's not the cabbage digesting itself with its own enzymes--it's the microbes producing the necessary enzymes to break down the sugars.
We also purposely deactivate enzymes to prevent discoloration, loss of flavor or texture, etc. Frozen vegetables are usually blanched first for this purpose. A frozen vegetable is essentially a cooked vegetable. If you saw what happens when you freeze, then thaw a raw, non-blanched vegetable, you'd have no qualms about this procedure.
Cooking/blanching, and fermenting may change or deactivate the enzymes present in a food, but I'm not persuaded that the enzyme deactivation is bad, nor that it's the root cause of why people have troubles digesting foods in various states. I sort of cringe when I hear people say things like "it kills the enzymes," as if enzymes were living creatures that we must eat to survive.