After months of having this issue I tried switching from the usual 5Ghz WiFi network to 2.4Ghz (my router broadcasts both as separate available networks) and ever since then notifications have been working properly even when phone is sleeping although I'm not sure why 5Ghz would have this problem.