Lets go back to the beginning if we can. The tank has been established for only a month or two total? Or this is an older established tank that you added a soil substrate to only a month or two ago?
You say the problem is reoccurring. When did it start? How often/frequently do you notice it? What is it exactly that you're noticing other than the red gills?
What makes you think the soil is giving off co2? Do you see something to make you think that or are you just guessing? Are you seeing bubbles coming out of the substrate? If so chances are it is not co2. Doesnt necessarily mean you're seeing hydrogen sulfide but it could eventually turn into that and what you're seeing now is just excess "gasses". A lot of people find it useful to take something like a chopstick to poke around in a dirt substrate. This helps release those excess gasses so they dont build up and eventually turn into a giant cloud of hydrogen sulfide. It also helps pockets of anaerobic substrate from forming; which you want to avoid.
I'm not sure what stress a fish might display from h2so4. However, red gills is almost always a sign of either ammonia or chlorine poisoning in fish. I see those test results in that photo but cant make it out too well. I'm tempted to say if that first tube is your ammonia test that it looks a bit green to me which would indicate more than 0; but the photo isnt too great so I cant say that for sure.
The tank is around 4-5 months of being established. It's been a reoccurring problem since the tank was first established, I noticed it with my old Khuli loach. Even a day or two after doing a 75% water change the gills would become red again, same thing with the danios. The khuli loach was present before I dirted the tank. I dirted the tank 3 months ago, I watched different videos of people setting up dirted tanks and did poke at the substrate with a chopstick, not only that I also vacuum the gravel, it gets turned a decent amount. There's only half an inch of dirt and maybe a 1 1/2 of sand for the cap.
The only thing in the 10 gal are the danios. I noticed some stress coming from the fish a week after getting them, I think the red gills were present early on. I saw scratching once and a couple of the fish swim up and down against the glass every now and then, it's never constant though. I watch them pretty closely and haven't seen any others rub on anything. I did a dosage of prime on Wednesday just in case it was chlorine, their gills are still red.
I've read that some people don't use co2 diffusers because the soil will release the co2 when you first set up a dirted tank. Sorry for the crusty photo, I use my garbage android to post on this site. I'm going to start using my laptop. I can assure you though the ammonia wasn't present. I dealt with ammonia issues a lot when I first joined the hobby; I made the rookie mistake of plopping fish in a brand new tank and without conditioning the tap water (yikes).. I did a fishless cycle once the fish inevitably died due to being so clueless. So my guess, given your input, that it is in fact chlorine.. or my tank simply isn't getting enough oxygen.
I get the water for my fish at my grocery store's filtrated water thing because my tap water is insanely
hard. What I do is I fill about 5 gallons worth of the water from the store and then fill the rest of the tank up with 2 gallons of conditioned tap water. I don't let the conditioner sit in the water for a full day though like one is supposed to. I just shake the water around. I'll let the prime sit next time I do a water change and see if that changes anything.