If it doesn't last forever this is some organisms consuming it. It is a matter of ecological niches, what are the requirements (humidity, temperature, etc.) to live and reproduce
I believe we should separate the discussion in two: small organisms and microrganises
Microorganisms that consume our food need to get there, either they got there from the air or they are already there. Other vectors can be insects, animals, water and soil but since this discussion is about food and we tend to keep our food protected from those vectors I'm going to ignore them.
Most of the microorganisms of interest (Bacteria, Archaea, Fungi & Oomycetes) exist in air as spores. This are analog to seeds, they are alive but inactive and need to arrive to a good environment to sprout. Spores can survive for many years, even millions of years("Revival and identification of bacterial spores in 25- to 40-million-year-old Dominican amber". Science. 268 (5213): 1060–1064.). This survival mechanisme includes dehydration and therefore rehydration is necessary for sprouting.
In addition some of these (mainly oomycetes) need free-water to live & reproduce while others require some levels of moisture.
Dehydrated organic material tends to be hygroscopic. Thus if the non-spore form of the microorganism lands on it the organism will probably loose water and die.
Microorganisms, like every organism, have niches they occupy. One of the characteristics of these niches is the temperature. Freeze-drying includes freezing which lowers the temperature below the survival temperature of many microorganisms and preserves the food. Microorganisms that grow in low temperatures grow slower so it will take more time for us to notice their presence. They still require water so the combination of freezing and dehydration provides a good protection.
Honey has a antibacterial activity in it preventing growth of microorganisms. In addition honey contains a lot of sugar and other molecules making it hypertonic to most microorganisms causing them to loose water if they land on it. Also his high viscosity prevents the free movement of microorganisms.
Many small organismes still need water to live and reproduce (like nematodes)
Insects are highly specified to their environment and food intake. They might not be able to consume dehydrated food.
In addition, as mentioned in the comments by Kal
a lot of these small organisms who are not interested in completely dehydrated "food" would also be ones who
don't explicitly drink water (at least, not enough).[...] For organisms that
don't explicitly drink water, their major source of water would come
from the food. So if the food doesn't contain enough water, they don't
Ants and other insects do eat dehydrated organic material like seeds, but it still has around %10 moisture
Oil is not hydrated but liquid, since it is oil and not water