I think I see your point though. at a high level, the neighborhood composition could be optimized for everyone to walk to work (wide range of incomes), or for everyone to walk to everything outside work (narrow range of incomes), but not both. or there's the US suburb approach where no one can walk to anything.
imo, assuming you're reasonably connected to work by transit, quality of life maximized by the latter arrangement (homogeneous incomes at the lowest level of organization). even if it's a little inconvenient, I will figure out how to get to work everyday. outside of work, a little inconvenience is the difference between doing or not doing all kinds of spontaneous activities.
But with or without specific affordable housing areas do gentrify and long-term residents don't necessarily like it even if it results in a "better"/safer/etc. neighborhood.