I definitely always saw it as two different periods in his life.
The first, his pro-British imperialist phase as exemplified by the white man’s burden, the second, a more critical of war phase, especially as WWI progressed, and likely peaked when his son died in 1915 in the war. (https://en.wikipedia.org/wiki/My_Boy_Jack_%28poem%29)
I don’t know specifically how it’s reconciled in Kipling’s case, but likely there’s an argument to be made for being pro-imperialistic, yet anti-war/anti-military. For example, some other readings I’ve done on that period of time, at least from French sources, argued that imperialism promoted peace, through increased security and the pursuit of shared progress (always ignoring that the European nation gained most of the benefit of that “shared progress”).