I was under the understanding that the plants and trees that became coal and oil didn't decompose because at the the time, nothing had evolved yet that could consume it. So it just collected on the ground with new stuff growing on top of it, forming this compressed mass of underground carbon fuel that we were able to exploit millions of years later. It could never happen today because all of that plant matter would rot before that could happen, because of the presence of bacteria that can break down plant matter.