And usually they release the update for their device slowly, sometimes takes weeks to months after it's released by Android team.
Furthermore, it could take years if we're talking about update to newer OS version, such as Nougat to Oreo.
Non-official OS such as LineageOS could help user in this case to get updates for extra few years, but it's limited for user who have knowledge/experience to install non-official OS or brave enough to do it without before-hand experience.