How often to clean:
So after all this, the question is how often do you need to do this, or if you really needed to at all: I'd say you likely didn't need to. And you likely will be fine if you never ultrasonically clean the firearm again. In order for it to make a practical difference in function, your pistol has to be so grimy and un-oiled/dry that the slide is slowed down during rearward travel during recoil that it doesn't reciprocate fully thus causing difficulty with ejection or chambering a new round, or slowed down while returning to battery. You would be fine if you never detail stripped it but cleaned what you could reach with a field strip. Most folks don't clean until after several hundred rounds, some will clean after each range trip, some are trying to prove a point so they don't for thousands of rounds with service pistols.
I would suggest detail stripping only as needed to modify or change out parts - or in other words infrequently on an M&P or other polymer frame pistol because it's that much more opportunity to gouge the frame holes that the pins sit in and over time the holes will widen/loosen if we're using our roll pin punch and hammer a lot. Say for example detail stripping every month or two versus installing a Apex trigger. If you want to explore and try it a few times great but you don't have to.
There are points to clean that will in theory prolong performance of your pistol and potential pitfalls too. Carbon rubbing on steel would in theory loosen tolerances over time -although I've yet to personally shoot loose a pistol - so wipe away crud then grease/oil where the barrel exits the slide (business end), grooves in the slide where it rides on the rails, and barrel lock up surfaces on the hood of the barrel. If brushing out the bore do so from the feed ramp end to avoid scratching up the crown of the barrel with the handle or body of the brush. Don't use steel brushes.
For the m&p specifically, taking the takedown lever and spring out for cleaning just for fun can be done without drama but for the frame pins in a battle between a roll pin, brass punch, and plastic frame the softest material loses. I've had to do a bit of work to install Apex items so in about 5 years of owning an m&p the frame pins have come out maybe 5-6 times to try different combinations of springs. If it weren't for the parts I wouldn't have to.