Would the Anglo-Japanese Alliance still form if Britain had taken Alaska and incorporated it into Canada?
Short answerYes; the alliance's purpose was broader balance against Russia, France and the United States, so Canadian Alaska would not remove the need for it.
NotesThe counterfactual begins by moving Alaska into British hands during the Crimean War, before its historical 1867 sale to the United States. That territorial change does not remove the strategic logic of the Anglo-Japanese Alliance. Britain would still need help balancing Russia, France and the United States across the wider Pacific. Canadian control of Alaska changes geography and later North American politics, while the alliance retains its immediate balancing purpose.