The British Raj and the effects of colonialism would have been uppermost in EM Forster’s mind when he sat down to write his stirring tale of imperialism, prejudice