Security Patch level old on Moto G5
Although the OS of Moto phones bears a resemblance to Google's stock or AOSP, Moto themselves isn't as committed as Google themselves to bring security patches in time - in fact, they explicitly stated that they will NOT guarantee monthly security patches like Google does with its Nexus/Pixel line.

As of now there's nothing you can do if you want to keep your warranty and stay away from custom ROMs.