The "popular theory" linked from the question suggests both that the Japanese expression may have come from the Malay, or that the Malay expression may have come from from the Japanese.
The Japanese あらまあ (ara mā)
Broccoli's answer covers the Japanese. In short: あらまあ is purely Japanese, composed of purely Japanese elements and formulated in a purely Japanese word-formation pattern. Any influence from Malay is vanishingly unlikely.
The Malay alamak
For this to come from Japanese, we have to ask, "where did that final //-k// come from?"
There is no apparent mechanism for this: there is no //-k// in the Japanese, nor is there any likely longer Japanese phrase where a following word after あらまあ might start with a //k-//, since this Japanese expression is phonologically a standalone. So a borrowing appears to be ruled out purely on phonological grounds.
An internal Malay derivation may make more sense.
As described over at Wiktionary, this is probably a combination of Allah ("Allah, God") + mak ("mother"), an expression of surprise, in similar fashion to Spanish madre de Dios, Dutch moeder van God, or Arabic أُمُّ اللهِ (ʾummu llāhi).