It sounds like a network problem. Are you using cloudflare? (if so turn off the orange cloud).
You could have a noisy neighbor at DigitalOcean, so you might open a ticket with them.
It doesn’t make any sense that you say you’ve done a rebuild but the version hasn’t changed. I’d think that you’d need to do the postgres 12 upgrade. Did you not see anything about that when you did the rebuild?