Of course it can affect muscle gain or retention! And of course the type, volume and intensity matters!
The more glycogen you burn for fuel, the more likely a method is to hurt your muscle gains.
First because depleted glycogen stores are actually a signal to put you in a catabolic state. But also understand that the more stored energy I must mobilize, the higher cortisol will be (because during exercises cortisol elevates to mobilize stored energy).
And cortisol hurts muscle growth many different ways (decreasing protein synthesis by increasing AMPK, increase protein breakdown, increase myostatin expression, etc.)
YES by "eating more" you can counterbalance some of these effect (glycogen depletion) .
An eating more itself is anabolic (a caloric surplus activates mTor which turns on protein synthesis) but it's also more anabolic to fat stores.
But you can't completely negate the effect of a cortisol increase simply by eating more. It's not just a matter of energy in vs. energy out.
YES having a pre-workout protocol of carbs and amino acids will help lower the cortisol response (by making energy readily available... less need to mobilize it ... less need to raise cortisol) but even that has its own limit.