AOSP is a compromise, because device manufacturers don't want to share anything. Google effectively negotiated with device manufacturers to open source part of their software. Device manufacturers lose some of their secret features to competitors. In exchange, they don't have to develop those features themselves. App developers get a standard platform, which benefits everyone: users and manufacturers and app developers.
This is very much a win-win situation, because the alternative is that every manufacturer has their own proprietary system.