I have tried set the wifi to never disconnect while in sleep mode but it still happens. Did not have the issue with the Moto G 3rd Generation, the Moto G5 Plus it happens constantly.
This is a problem that many are still experiencing (both within Republic and other carriers)
See Is your phone losing its WiFi connection while sleeping? (a very long thread)