Could the country be partitioned into Chinese and Malay areas before independence similar to India and Pakistan
I'm afraid that it doesn't quite work this way. The nature of British colonisation was such that the Malay Kerajaan retained de jure political control for the entire period of de facto British rule but economic power was accumulated in the hands of the “newcomers”, i.e. Chinese and some Indians. This was typical of the divide et impera policies of the British and would have severe consequences post-1945. Up until the post-war period, the Chinese were very much seen as economic migrants and most did not identify with the land but chose to be repatriated to China after the failure of the Malayan Union. For the Malays to accept a partition of their homelands would be akin to asking the British to allow the secession of Bradford due to the high numbers of Pakistani immigrants living there. Furthermore, apart from the island of Singapore, there was no clear majority of Chinese in any other Peninsular Malayan states and there certainly wouldn’t be a contiguous territory for partition (not like that mattered for the British in India). Finally, there was no Chinese voice asking for petition in the first place. There was no ethno-nationalist Chinese political party. The Malayan Communist Party, despite being predominately made of Ethnic Chinese, was multiracial in rhetoric. The comparison to the Raj is spurious since neither the Chinese, Malays nor the British wanted partition. Indeed, the eventual Federation of Malaysia was a union of 6 different political entities: the 4 Federated States, 5 Unfederated states, the Straits Settlements (Singapore, Penang, Malacca and one more minor one I can never remember lol), Sabah being run as a chartered company, the White Rajahs of Sarawak and the Protectorate-status of the Sultunate of Brunei (the only one to express no interest in ever joining the federation, though it was offered). Forming the federation was a herculean task in itself and splitting it along racial lines was inconceivable to the parties involved.
While the racial riots in the 1960’s were truly quite harrowing, there was no chance of an ethno-civil war due to the lack of militarisation of Chinese society. Apart from the MCP, which as mentioned before was not an “ethnic” party, the Malayan Chinese population was by and large unarmed and politically apathetic. However, it is also unlikely that we would see a wholesale massacre of the Chinese by the Malays as occurred in 1998 after the fall of Suharto in Indonesia. At that time the percentage of Malays might have been as low as 48% of the total Malayan population.
The Dayak’s of Sabah and Sarawak are not considered Bumiputera’s and do not self-identify as Malay.