The word "singer" is pronounced as /ˈsɪŋ.ər/ having /ŋ/ and not /ŋg/ in Standard Englishes. On the other hand, the word "longer" is pronounced as /ˈlɒŋɡər/ having /ŋɡ/ and not just /ŋ/ in Standard Englishes. "Longer" is derived from "long" which only has /ŋ/.
There are some other words as well, like younger, youngest and the superlative form of "long": longest = /ŋg/
And those which have only /ŋ/: ringer, hanger, banger.
I read this answer (“English” pronounced as /ˈɪŋlɪʃ/ ING-LISH [closed]) and it suggests:
Word-internal [ŋg] mostly remained (as in finger, anger), but an originally word-final -ng- that becomes word-internal only as the result of the addition of certain suffixes is pronounced [ŋ] (e.g. singing, singer).
The -ng- in English is not word-final, and -lish is not a suffix here, so it isn't expected to be pronounced [ŋ] according to the pronunciation patterns of the most commonly described dialects.
The er is a suffix in both "longer" and "singer" but they are pronounced differently.
Why is "singer" not pronounced as /ˈsɪŋɡər/ or "longer" as /ˈlɒŋər/?
Is "longer" an exception to this rule or there is a specific reason?