Aggregation theorems hold if endowments are endogenous?
The answer is it depends on more assumptions on preferences. The short answer is no. To provide as much intuition we will look at the optimal conditions in each of these problems.

First, for the descentralized problem you have that individuals choose $(c_{0i}, c_{1i}, \eta_i)$ to maximize:

$\max \qquad \sum_t \beta^t u(c_{ti}) $

$s.t \qquad c_{0i} = e_{0i}(\eta_i) - \eta_i p$

$ \quad \qquad c_{1i} = e_{1i}(\eta_i) + \eta_i X$

The solution, for each individual $i$ will be optimal if they follow the Euler equation derived from the first order conditions and that markets clear:

$\frac{1}{\beta} \frac{u'(c_{0i}^*)}{u'({c_{i}^*)}} = \frac{p - e_{i}'(\eta_i^*)}{e_{1i}'(\eta_i^*) + X}$

Now look at the representative agent problem for whom you say the endowment is given by $\bar e(\eta) = \frac{1}{N}\sum_{i} e^i(\eta)$. I will drop the $N$ because scaling does not matter (you are assuming the mean endowment, I am using the total endowment so all of my solutions are $N$ times what you want). This agent's problem is to choose $(c_0, c_1, \eta)$ to maximize:

$\max \qquad \sum_t \beta^t u(c_{ti}) $

$s.t \qquad c_{0} = \sum_{i} e_{i}(\eta) - \eta p$

$ \quad \qquad c_{1} = \sum_{i} e_{i}(\eta) + \eta X$

Now the first order condition says:

$\frac{1}{\beta} \frac{u'(c_{0}^*)}{u'({c_{1}^*)}} = \frac{p - \sum_{i}e_{i}'(\eta^*)}{\sum_i e_{i}'(\eta^*) + X}$

These two need not be equal. Do you have more assumption on the preferences/endowment functions?