The unpleasantness of mosquito bites is not something useful for mosquitoes, but it *is* useful for the ones who suffer it
The way our bodies react to mosquito saliva motivates us to avoid being bitten. Which must have had evolutionary benefits, keeping us away from diseases....