No plants but coal still formed?

coal britain formation
If coal is formed by very slow natural process and has been formed in most geological ages then it must have been started to be created in the most recent geology periods?

And how was coal created when there were no plants on land, before there were land plants?

Mind the coal gap

coal britain mining

The wide, shallow seas of the Carboniferous Period provided ideal conditions for coal formation, although coal is known from most geological periods. The exception is the coal gap in the Permian–Triassic extinction event, where coal is rare. Coal is known from Precambrian strata, which predate land plants — this coal is presumed to have originated from residues of algae.
Formation of coal | Wikipedia

Why is so much coal mined on or very close to the surface of our planet?