I bought an S9 last week, 3/8/19, and am having the same issues. Everything updated, everything given proper permissions, etc. Nothing I have done seems to fix it. My wife got her new S10 the same day, and is also having these issues with her gmail.
To be honest, this is really annoying.
My S9 is two weeks old and I am having the same issues.
I have followed this thread and done everything suggested but it still persists.
I am now begining to think that its a Gmail issue and not samsung.
I THINK I FINALLY FOUND THE FIX!! It is indeed a Samsung issue, not Gmail. The reason I say that, the more I dug into this I found that there were alot of things not staying in realtime; weather apps, facebook messenger, etc. The fix is in the battery optimization setting as everyone said, I missed it the first time around. Go into settings and search for "Battery Optimization Usage". There is a pull down just below that which reads "Apps not optimized". Pull that down and select "All". This is where I missed the first time around. Gmail was listed under "Apps not optimized" but when I pulled down and selected "All" there it was again and it was turned on. I went into "All" and turned off anything I wanted to stay in realtime. It has been a couple weeks now and all seams to be good. Emails still take 5 minutes or so to show up on occasion, but I haven't had any wait hours to show up. My wife did the same on her S10 with the same success.
I did the same, went into settings - apps - gmail - battery and changed the optimization to "off"
So far so good, but it's only been a few hours now and usually every workaround stops working after a couple days.
A bit worried about the battery life though, Samsungs are now well known for their optimal battery life...