CO2 and methane both have natural feedback loops that can cause increasing temprature to release more of both, which in turn causes more warming which causes more release and so on and so forth. This is one of the big worries about human caused greenhouse gasses, that they will trigger these feedback loops causing far more drastic warming. Negative feedback loops also exist so making it colder can trap more or release less of these gases. I will give a few examples of those feedback loops.
Methane hydrates, A lot of the seafloor has methane hydrates trapped in the sediment, if you warm that material it releases methane gas, a lot of it. This material builds up very slowly but can be released very quickly, so there is plenty available to warming water to release. Higher pressure can mitigate this but the temprature has a stronger effect than pressure from rising sea levels. Of course if you cool the sea more of this methane is trapped as hydrates reducing the amount in the atmosphere.
Permafrost also contains methane hydrates and other organics, the cold and ice keeps them inactive and trapped but warming it triggers the release of both methane and trapped carbon (which is released as CO2). so as the polar regions warm the release out these stored gasses, if they get colder they trap more it.
Biology, there is a really interesting feedback loop in microbial life, ocean and wetland life in particular respond to warmer temperatures by releasing more CO2(or absorbing less), how much is difficult to estimate but that they do increase CO2 has been repeatedly confirmed even if weak on a geological time scale this will quickly add up.
This effect is much stronger in wetlands and wetlands have the additional effect of releasing more methane with warming temprature at the same time, Methanogenesis. additionally they also convert CO2 into methane and how much is based on CO2 concentration and temprature, so increasing CO2 will result in more methane directly.
Ocean circulation, warming the planet changes ocean circulation patterns, and the current pattern with a lot of mixing due to wide differences in temperature. is really good at absorbing methane and CO2 into sediment and microorganisms. warmer oceans result in less mixing which means less gases released by other means getting absorbed.
On a geologic scale the movement of continents can affect all of these, so that adds one more thing that will tend to change both in the same ways.