2 firms production decision for one agent
Seems like you are assuming there will be an interior solution.
$$
(a-2b x-c^X)w-by = 0
$$
only needs to hold if the value of $x$ is positive. If it is not, but $x = 0$, the lowest possible amount, then 
$$
(a-2b x-c^X)w-by &lt; 0
$$
is not a contradiction. Further decreasing $x$ would increase utility, but it is not possible. Therefore in the case when $w = 0$ and
$$
(a-2b x-c^X)w-by = -by
$$
you do not necessarily have $y = 0$.