The way to understand the origin of fossil fuel deposits is that hundreds of millions of years ago trees were made of plastic.
Thats not quite literally true but it gives the right sense. In the Carboniferous period trees grew abundently but there were not yet bacteria that could break down the lignins composing the woody structure. Its very similar to what you'd get with plastic trees today: they would fall and pile up like junk in a landfill. Then eventually this would be buried and result in the many-meters-thick coal deposits we find today.
Lessons? I don't know. But piles of un-decomposable hydrocarbons is not a new thing for the planet.