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.

I.e. all those people that didn't mind them and never got itchy from mosquito bites appear to have died out. And mosquitoes really wish that wasn't true.