I don't see why a mag safety requires a magazine to be on hand for cleaning. First thing you do is either lock back the slide ejecting the chambered round, or drop the mag then lock back the slide. The requirement is to clear the chamber and for that, the lack of a mag in the gun is required.
Once racked you can then proceed to whatever is next in removing a pin or catch to release the slide.
Reassembly doesn't require the mag either. And half the function check shouldn't involve one - part of the check is to proof the mag disconnect does work. That leaves checking to see the hammer does fall, and I don't see any responsible shooter of merit inserting a LOADED magazine in the weapon to do that.
CLEAR THE MAG. If you can't, then insert, chamber and leave that check off your list. Will you get killed? Odds are no, because most firearms don't field strip to the point where you will disturb how the trigger works. If it does - make a serious adjustment in your routine, keep a mag available that will be used for that check. Function checking is a fine thing to do - if you are in a situation where you daily face danger in armed confrontation. For most of us that isn't the reality - we carry for the once in a lifetime event. If you can't safely function check with a empty mag, I have to ask, just where does that happen? Most CCW clean at home - if the gun is anywhere outside a pocket or holster outside the home then it better be a range - no major mag issue there - or you've already called 911 and it's out to be used - where you will likely wind up with an empty mag.
I've been trained on both mag and no safety guns in the military, it's not really an issue either way. The mag safety does have one specific advantage for the duty carrier - if grappling for the gun it's possible to disable it. It also implies you will have a needed backup weapon or the extensive skills to defeat the opponent resoundly. For the average CCW, it really has little affect. If you PROPERLY clear the weapon it's unnecessary. Unfortunately, no, there are inexperienced, even momentarily unintelligent owners who drop the mag and then pull a trigger. The real issue there is a bad case of self inflicted derp - and there is no law that can prevent it. Just self discipline. For the most part we as a group of humans do a pretty good job of it. We just understand we cannot accept anything less than 100% safe interaction with our firearm as our goal. It's not something we attain, it's something we constantly train.