Can Android differentiate between headphones and headset? Regardless if I plug in a headset or headphones (without a microphone), I get a headset icon in my notification bar.

I would expect Android to use the builtin microphone in case normal headphones are connected, so I do not have to unplug my phones when someone calls.

Alternatively, is there an app or widget to manually toggle between headphone and headset mode?

I have an HTC Desire with CyanogenMod 7, so I am not sure if it is a problem with CM7 or Android in general.
You can see the details of this at the Android developer documentation, but an app can definitely tell if a wired device plugged into the audio jack has a microphone or not. I will tell you that this information is not always accurate or consistent across devices though, as I have experienced with my own app Hearing Saver. Sometimes different phones send different codes for this particular bit of information, so if you are experiencing difficulties with certain apps not recognizing your headset, I'd get into contact with the developer of that app.