You probably need to look into disabling the Android phantom process killer. I had a similar issue and could not get DEs such as XFCE running for a long time and after the fix it was smooth sailing.
I think that is what I did. I had pretty good stability for some things, but I was really pushing the limits by trying to run Intellij. I could get some Java code to compile and run, but it would always terminate eventually.
Of course, the Pixel 5 only has 8GB of RAM total. It might be a different story on the 7 pro or s23 ultra.
There are meanwhile quite a few Google references, the one I used at the time is referenced on this comment in the issuetracker: https://issuetracker.google.com/issues/205156966#comment52