One can mark Gandhi's Hind Swaraj (1908), when Gandhi was 39, as a key marker in the evolution of his thinking. (Without endorsing all that in this essay on interpreting Hind Swaraj, I nonetheless recommend it as an essential shortcut to understanding it.) Even so (chapter 15) - and you can read this in many ways -
By patriotism I mean the welfare of the whole people, and if I could secure it at the hands of the English, I should bow down my head to them.