'Megapixels' is a term largely used for marketing purposes, but it's really not all that important. It's a bit like measuring power output from an audio system in PMPO instead of RMS. You need to take into account sensor sizes and sensitivity, lens quality, the capabilities of the image processor etc... etc... For the most part, people who buy phones for their cameras or even standard point-and-shoot cameras don't care (or understand) the relevance of any of that. Cnet wrote an article touching on it a few years ago: http://www.cnet.com/au/news/camera-megapixels-why-more-isnt-always-better-smartphones-unlocked/
There is a reason why very high quality lenses cost thousands of dollars (Canon have been known to push the boundaries of 'glass' with some mammoth lenses; One such lens is their 5200mm which weighs about 100KG and costs USD$50k).
I have a Canon 350D SLR (which is an 8MP camera) that is about 10 years old. Compared to my LG G4 phone (which has a 16MP rear camera), the Canon shits all over it in terms of image quality.
Don't get me wrong, there are some amazing phone cameras out there and to pack such technology into a small form factor is just brilliant, just don't believe the marketing. Just like you wouldn't buy a car and base its performance on the size of the engine and the number of cylinders; These days you can buy a 4-cyl Volvo which will out-run an Aussie V8.
The main advantage a DSLR has is glass (like you said). However, the other benefit is being able to shoot in RAW and do your own post processing.
There are various apps that let you do something similar with your phone as well. You see, the imaging interface software (which is part of the OS, sort of like a driver) does a lot of post-processing for you. If it's not done right, the images can look pretty terrible, even with a good lens and sensor. (That has been a particular problem on the Android side.)
So these apps will bypass (or disable) the automatic post-processing and spit out an uncompressed, high resolution TIFF (or Q100 JPEG) file. This way you can do your own processing and compression. It's not quite as good as working with a RAW file (which is literally the raw pixel data straight from the CCD), but being able to work with a lossless file is still nice. (Remember, every time you edit and re-save a normal JPEG, you're losing quality; just like copying video or audio from one magnetic tape to the next to the next.)
Well worth grabbing one of these apps if you're serious about taking good photos with your phone. (My Canon 40D is nice and all, but the best camera is the one you have on you!)
I use 645 PRO, GCam, ProCamera and Camera+ on iOS.