This isn’t a BA issue, so we’ll move it into the QR forum as it seems they are your preferred choice of carrier, but unless I’ve misread your post I think you’ve misunderstood the quarantine requirements on return to the UK.
Just because you transit through Portugal does not exempt you from the red list requirements which currently apply to South Africa (and, indeed, Qatar). You would need to stay in any transit country for 10 days after you leave your last red list country before you return to the UK to come under their terms of entry (I.e. amber or green). Your proposed <24h transit just wouldn’t work.
As things stand today, you would need to book the mandatory UK quarantine hotel at your own cost if you take this trip.