When is it better for a gene to cause a biased sex ratio?
Well first if a gene is not on a a sex chromosome there is little advantage in changing the sex ratio. This is why most of the ultra-selfish genes we know about are on sex chromosomes. A gene is not helping itself spread if makes more Male offspring unless one of two things is true, it is on the Y chromosome or there is already a bias making male offspring more successful. the latter actually helps keep populations rex ratios stable since if there are more of one sex generally having offspring of the other sex is an advantage.
The most impactful sex ratio altering genes we know about result in selfish sweeps where populations can collapse as they take over and eventually prevent mating entirely. but up until that final generations with no mates the gene in question has an advantage, evolution does not care about the survival of the species or population, if a gene can improve its own ability to spread at the cost of the population then so be it. fitness at higher levels is basically irrelevant. A gene is perfectly capable of spreading by favoring itself and driving the species/population extinct. In many ways run away sexual selection is this in a nut shell, detrimental to the individual and population but beneficial to the gene.