Why isn't electric field due to outside charges taken into account when calculating the "total" field in some Gauss law problems? 
In the above picture there are two point charges $q_1$ and $q_2$. $S_1$ and $S_2$ are Gaussian surfaces centred about $q_1$ and $q_2$ respectively. If I want to find the electric field at P, then I have to apply Gauss's law to both the Gaussian surfaces $S_1$ and $S_2$. In other words outside charges can cause there to be an electric field at P even though the flux because of the outside charges is zero on that surface.
But when calculating the field inside a uniformly charged sphere, we completely neglect the outside charges(outside the Gaussian surface but still inside the sphere). I know that is because of Newton's shell theorem but E&M books do not mention this. They just go with Gauss's law.

Consider the example-4 in chapter 2 in Introduction to Electrodynamics by Griffiths
The problem statement is as follows:

A long cylinder (Fig .21) carries a charge density that is proportional to the distance from the axis $\rho = ks$, for some constant k. Find the electric field inside the cylinder.

In the solution for the problem, he finds the field of a cylindrical gaussian surface in a larger coaxial cylinder using a gauss theorem. This field is said to be the electric field inside the cylinder but the gauss theorem doesn't really consider the field due to the charges between the gaussian cylinder and the outer cylinder. Hence, it must not be the 'total' field which we have found. So, my question is what exactly does Griffith mean when he says 'the electric field'?
Edit:
Suppose I applied Gauss law on the surface $S_1$. If the field due to $q_1$ and $q_2$ are $E_1$ and $E_2$, then
$$\oint \mathbf{E} \cdot \mathbf{da} = \frac{q_1}{\epsilon_0}$$
$$\oint \mathbf{E_1} \cdot \mathbf{da} + \oint \mathbf{E_2} \cdot \mathbf{da} = \frac{q_1}{\epsilon_0}$$
The second integral vanishes and so I get
$$E_1 \oint da = \frac{q_1}{\epsilon_0}$$
What I get is the magnitude of the electric field due to the charge enclosed but that is not the total electric field at P. The total electric field at P has magnitude $|\mathbf{E_1} + \mathbf{E_2}|$.
I can use the same argument for the Griffith's example. If $\mathbf{E_i}$ and $\mathbf{E_o}$ are due to the inside and outside charges, then what Griffith's solved for is the magnitude of $\mathbf{E_i}$ because
$$E_i \oint da + \oint \mathbf{E_o} \cdot \mathbf{da}\text{ ( = 0) } = \frac{\int \rho dV }{\epsilon_0}$$
would give me the same value of electric field as Griffiths got. But that is not the net electric field at that point. The magnitude of the net electric field at that point is $|\mathbf{E_i} + \mathbf{E_o}|$. But in problems like this, the field we get from Gauss's law is simply referred to as the electric field as if it's the net electric field. The only way it is the electric field at that point is if the contributions from the outside charges cancel out. That would be true for something with spherical symmetry because of Newton's shell theorem, but how would that be true for something with cylindrical symmetry like in the Griffiths example?
 A: Let's start from the Maxwell equation
$$
\nabla \cdot {\bf E} = \frac{\rho}{\epsilon_0}
$$
On the left here is the divergence of the total electric field at some point. On the right is the charge density at that point. The field on the left is owing to all the charges in the universe. Its divergence only depends on the local charge density.
Now integrate over volume and apply Gauss' divergence theorem:
$$
\oint {\bf E} \cdot d{\bf S}  = \frac{Q}{\epsilon_0}
$$
the field on the left is still the total field at each point, as produced by all the charge in the universe. On the right we have the total charge $Q$ inside the region of integration.
Now we can note that the total field can be expressed as the sum of field due to charge inside the region, and field due to charge outside the region:
$$
{\bf E} = {\bf E}_i + {\bf E}_o
$$
so
$$
\oint ({\bf E}_i + {\bf E}_o) \cdot d{\bf S}  = \frac{Q}{\epsilon_0}
$$
But the field ${\bf E}_o$ is, by definition, what the total field would be if the charge inside the region were not there, and we only had all the other charges in the universe. By applying the Maxwell equation to that case we must find
$$
\oint {\bf E}_o \cdot d {\bf S} = 0
$$
and therefore
$$
\oint {\bf E}_i  \cdot d{\bf S}  = \frac{Q}{\epsilon_0}
$$
So you see we can consider the field inside the integral to be either the total field or that part of the total field which is owing to the enclosed charge.
That answers your question, but I will also add a comment to show why it is important to know this full answer. It concerns how one does the integration, and interprets the result. If we apply the method to one plate on a capacitor then we shall find that the total flux out of one surface of the plate is $Q/\epsilon_0$ where $Q$ is the charge on the plate. Then the question arises as to how this flux is divided between the two sides of the plate, and whether what we want to know is just ${\bf E}_i$ or the total field ${\bf E}$. Usually we want to know ${\bf E}$. For an ordinary parallel plate capacitor the answer is zero on one side and $Q/A\epsilon_0$ on the other, but for a single flat surface of charge in otherwise empty space the answer is $Q/2A\epsilon_0$ on each side. In order to get this right, it is important to understand the starting point of all this, where it is the total field that appears in the Maxwell equation, not just the field due to any particular group of charges. In the capacitor example the total field is the net result of the charges on both plates, not just those inside the integral over one plate.
A: Gauss law (if applicable) finds the total electric field.
$*$ But please note that the integral form of gauss law cannot be applied for the first question asked.
The step in gauss's law $\int \vec{E} \cdot \vec {ds} =E \int \vec{ds} $ can only be done if the field is symmetric and has a constant value over the surface. This is true for spheres and cylinders with uniform charge distribution, but when two spheres are kept as shown, the field could be complicated. Finding a surface with same value for $E$ would be hard.
You're right in saying that the outside charges are producing a field inside for a general (asymmetric) distribution. But in cases where the charges are symmetrically distributed, The net electric field by all external charges cancel out. Newton's shell theorem is one example of such symmetric mass distribution.
For some examples : Any charge distribution which is a function of $r$ alone, $\rho(r)$ can be imagined to be due to concentric spherical shells, each of whose electric field inside is zero. So it goes with circles and cylinders.
So for the question from Griffiths, The field is symmetric, So gauss's law can be applied, and also, No Electric field from outside is present inside due to symmetry. So the electric field obtained is the Net electric field.
For the first question asked, the charges $q_1$ and $q_2$ together produce a complicated Electric field, for which finding a Gaussian surface would be hard. But we could use superposition theorem of electric fields : The net electric Field at any point is the vector sum of fields due to all individual charges considered separately. (as if other charges were absent).
So we could find the Electric field at $P$ due to $q_1$ and $q_2$ alone and add them to get net electric field.
$*$ Please note that though gauss's law cannot find electric fields always, the law is always true. The net flux through any surface due to outside charges is zero. symmetry is necessary only when we have to find Electric Field.
A: Everyone, thanks for trying to help me today. I think I finally understand
what's going on. As I suspected, I was missing a symmetry argument. I will try
to illustrate what I mean by an example.
Suppose I want to find the field inside a sphere of radius $R$ with charge
density $\rho (r)$. So I take the Gaussian surface as a sphere of radius $r_0
< R$. Now on the surface of the Gaussian sphere I know for a fact that the
total electric field must be radial. Because of the symmetry of the problem.
Everything looks the same when I rotate the sphere so the field lines have to
look the same too. Because the total electric field is radial and constant on
the surface of the sphere, I can pull it out of the integral. So I can say
$$(E_i + E_o) \oint da = \frac{q_{enc}}{\epsilon_0}$$
$$E_i + E_o = \frac{q_{enc}}{\epsilon_0 \oint da}$$
On the other hand I also know that $\oint \mathbf{E_o} \cdot \mathbf{da} = 0$ from which it follows
$$E_i \oint da + \oint \mathbf{E_o} \cdot \mathbf{da} = \frac{q_{enc}}{\epsilon_0}$$
$$E_i = \frac{q_{enc}}{\epsilon_0 \oint da}$$
The only way both these equations are true is if (by subtracting one from the other) $\mathbf{E_0}=0$. In other
words, when the symmetry allows us to pull the entire electric field out of
the integral, the contribution from the outside charges is zero. The net
electric field is the field due to the enclosed charges only, in such cases. I do not need Newton's shell theorem or anything like that to know beforehand that the contribution to the field of the outside charges cancel. The symmetry of the problem already tells me that!
Griffith's example was such a case. Under rotation about the cylindrical axis
everything looked the same so the total electric field must be in the radial
direction (radial to the cylindrical axis) and constant over a cylindrical Gaussian surface. My first example
was not such a case because the total electric field was not constant over
$S_1$ and hence outside charges did end up contributing to the total electric field at P.
