How old is your Pixel, though? If you try to use a phone that's old enough, you'll experience this every now and then, especially when switching between newer, RAM-hungry apps.
Go for a non-flagship, less-expensive phone with less RAM, and I expect it happens even more often.
(To be fair, my experience has been similar: on my Pixel 4 I don't have issues like this. But I've seen it happen on older phones in the past.)