There are and have been ongoing issues with Gmail and Apple Mail over several years and OS's. In my experience it has always been a Mail issue. That's not to say Mail is faulty just that it seems to have problems coping with things that Gmail does. That's why it seems to right itself after a while but this doesn't seem to happen as frequently or at all with other providers.
This is why I gave up on Mail about 4 years ago, swapping to AirMail.
My wife only a few meters away on same device, same network, same macOS would have Gmail go offline for no apparent reason on Mail while my Gmail accounts almost never did on AirMail. The difference was pretty obvious.