The native macOS screen recording cannot pick system audio as an input. However, if your Mac has an Intel chip, you could install something like Soundflower to add a system audio option as an audio source. But not that does NOT work with M1/M2 Macs (yet).
As others mentioned, third-party software like Loopback by Rogue Amoeba would let you do almost anything with audio on your Mac, redirecting audio where you want it.
There is also third-party software that does the whole screen recording process, including system audio. I've used Screenflick. It includes software called "Screenflick Loopback" as an audio source, which puts both system audio and in-use microphone(s) as an audio source for the recording.
Here's an article that gives more info about these options, although it's old enough that it doesn't mention Soundflower not working with newer Macs.
https://techpp.com/2020/01/28/macos-record-internal-audio-screen-recording/