Have you looked into the “Activity” settings within system settings already? When you click on the default activity there you should see the option “Automatically shutting down or sleeping”. I’m sure you already tinkered with the energy system-settings.
Easy fix if nothing works. Find the specific pipewire-version that causes the webcam bug, compile and install it, possibly render your sound settings partially defunct on the way and hook up a webcam. Thank me later.