Do perfect gases react when placed in a container whose volume can vary?
You have yourself all wrapped around the axle with odd conditions. 


  Suppose that $n$ moles of four generic perfect gases...


This is a really odd way to specify the initial concentrations of four gases. Say I have 5 moles total. There are four gases, so I have four unknowns and only two equations (total moles and equilibrium equation) which is unsolvable. 

This is also ambiguous. It is $n$ moles total, or $n$ moles for each gas?


  Now, if temperature and pressure are constant, then so will the density of the gases be. But if the density is constant, then the concentration of the gases will be constant as well, ...


Since you're holding temperature and pressure constant, and given the reaction:
$$\ce{A(g) + B(g)&lt;=&gt;C(g) + D(g)}$$
then the density will always be the same. Even if you have all A and B which are totally converted to C and D, the density of the gas mixture will be the same (assuming ideal gas behavior which you stipulated). 

If at a constant volume and the reaction had been:
$$\ce{2A(g) + B(g)&lt;=&gt;C(g) + D(g)}$$
then the density would change as the equilibrium shifted. 

But since you stipulated constant temperature and pressure then the volume would also have to change as $\ce{2A(g) + B(g)}$ was converted to $\ce{C(g) + D(g)}$ to maintain constant pressure, so the overall density of the gas remains constant. 


  But if the concentrations are constant, then at the outset of the reaction, when there are n moles of each gas, the reaction is already at equilibrium, because the reaction quotient $Q=K_c$. 


Let's break this down. If the concentrations are constant, then the reaction is already at equilibrium. 

It does not necessarily follow that when there are $n$ moles of each gas then the reaction is at equilibrium. That would only be true if $K_c = 1$, but $K_c$ has not been specified. 


  If not, how will the number of moles of each gas vary with time?


Ok, let's assume $n$ moles of each of the four gases. You'd also need to provide the rate constants for the forward and reverse reactions to calculate concentrations over time. Without the rate constants it isn't clear if the equilibrium will be established in seconds or years.