Apps like Viber, Messenger, WhatsApp, etc. whitelisted from Doze mode on Samsung without asking
May I answer your question in a reverse order:


  maybe Samsung just knows some well known apps and whitelists them by default itself?


Definitely. It's a common practice in China to have a built-in battery optimization whitelist to contain famous Chinese apps like QQ and WeChat (and Weibo and such) for convenience issues. So I suppose it's not restricted to China, but also that Samsung could make the same approach.


  is this maybe possible on Samsung despite the spec?


Yes. Not only Samsung, but also OnePlus, Xiaomi, Huawei, etc. IMHO Samsung is very considerate when designing their ROMs.


  according to Android specs an app must ask the user to explicitly allow whitelisting (Am I wrong here)?


Partially wrong here. An app cannot whitelist itself without user intervention. But it's not required that the ROM does the job instead.