I had this problem: I needed to record everything from both input and output of my computer. The practical case was recording an audio conversation over meet.jit.si
One of the typical solutions involved a complex layout of pulseaudio modules, arranging the audio flow until it reaches your goals. Those might work, but I tried it over and over and think it's just too complex to Just Work &tm;
This solutions that I propose is much simpler and has some advantages, provided that a small delay between the two flows (in/out) don't really matter to you, or you are willing to realign it in case you really care. In my case (it was an interview, not a live performance!) that was a decent compromise.
Pro
The current script is very simplistic. It might be improved supporting multiple flows; avoiding this mess of stereo-to-mono; handling temporary files decently; saving audio with a good name. Take it as a start
Just run this script (download):