It is pretty much as you say--a matter of decay--of organic matter being consumed by anaerobic bacteria.
In fact, some scientist say that the amount of anaerobic bacteria in the Earth is staggering--that the total weight of them is greater than ALL the organisms--us included--on the land and in the ocean.
Some scientists have looked further into this and many believe that this ancient organic matter can be changed into oil--and is still ongoing--by this anaerobic bacteria even today!
That’s not true, AB.
As a child I was taught that oil came from the remains of the dinosaurs.
Sounds like you understand what I’m saying with that compost pile but why do you think they call it “fossil fuels”? It’s not from the fossils of dead animals, it’s from that breakdown you and I understand as the gardeners we are.
I’m jus’ sayin’.