I haven't tested it with Pi 4, but likely it will work to some extent. Not 100% optimized of course, but better than nothing. Feel free to help out with improving it.
Have a look at my project Nard SDK which is exactly what you're looking for. A RAM only embedded Linux distro.
Another ramdisk distro alternative is my Nard.HawaiianPi wrote: ↑Mon Sep 10, 2018 10:34 amIt runs entirely from RAM, so no writes to the SD card.