What is Chanukah?
The Sages taught:
“On the twenty-fifth of Kislev......”
“The days of Chanukah are eight .....”
When the Syrian Greeks entered the Sanctuary, they defiled all the oils that were in the Sanctuary. And when the kingdom of the family of the Chashmonoim, [who were Kohanim] overpowered them and defeated them, they searched and found only one undisturbed cruse of oil that had remained in its place, with its seal of the High Priest intact. Yet the oil was only sufficient to light the Menorah for one day.
The Talmud in tractate Shabbos 21B
The Gemara asks: What is Chanukah? As the Rabbis learned, on the 25th of Kislev [begin] the days of Chanukah, eight in number, during which it is forbidden to eulogize or to fast. For when the Greeks entered the Holy Sanctuary, they defiled all the oils that were in the Sanctuary. When the royal Hasmonean house overpowered them and vanquished them, they searched and found only one flask of oil that lay there with the Kohen Gadol’s seal, and it contained enough oil only to kindle for one day. A miracle occurred with it, and they kindled with it for eight days. The following year [the Hasmoneans and the Sanhedrin] established and rendered [these eight days] as festival days — with respect to Hallel and “thanksgiving.”
They did not have to break the seal to contaminate the oil, even just shaking the oil with the seal on would be enough to contaminate it as gentiles come under the category of Tumas Zov which contaminates by shaking. So, to ensure that it was not impure it had to be inside the ground like the books say.