Euclid preparation. XIX. Impact of magnification on photometric galaxy clustering