In many treatments of statistical mechanics, I have seen a derivation of the canonical and grand canonical distributions by maximizing the entropy in equilibrium with appropriate constraints using Lagrange multipliers. However, I know for a fact that the entropy of a non-isolated system can decrease, provided that the total entropy of the system plus its surroundings increases.
Why then can we get these distributions which talk about non-isolated systems with maximizing the system's entropy, without also thinking about the environment? Shouldn't we be using other appropriate thermodynamic potentials for this?
I think you mix up two concepts here: (i) the evolution of a system toward equilibrium and (ii) the heuristic argument to choose the phase space distribution (or the density operator in quantum mechanics). The latter goes like this: the statistical entropy $S$ is a measure of our lack of knowledge of the distribution; we should choose the distributions which do not contain more information than the minimum necessary to account for our knowledge of the system (total energy for the canonical ensemble, and total energy and number of particles for the grand canonical); thus we choose the distributions that maximise $S$ under appropriate constraints. This says nothing about the march to equilibrium.