The - seemingly - easiest way to trigger this is to stream audio via the Music.app, have Apollo (Reddit-client, og Reddit app may be even worse) in foreground and switch back and forth between those...
That is app specific behavior and probably working as intended from the OS point of view. OS prioritizes the UI and background apps are even stopped, if they are poorly implemented. This is not the fault of missing RAM, instead app developers should know what OS does in these situations and reload the situation from the cache, not from the RAM, depending on their implementation and needs.
I use official reddit app, spotify, audible, browser, crypto apps, lichess, maps and probably some other apps and frequently switch between them and they always keep their state.