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.
Interesting, I never thought about this. It makes sense. Early peoples definitely took measures to reduce bites. Burning specific plants that repel them. Slathering their skin with mud, clay, or oils. Crafting mosquito resistant clothing and bedding. For thousands of years before germ theory.
While mosquito bites are unpleasant in themselves due to the itching and swelling I don't think it's common for cultures to have worked out the causal relationship between mosquitos and diseases like malaria. But I'd be happily educated otherwise.
Well the point is that people who had a bad reaction to mosquito bites tend to avoid getting them. Therefore they tend to live longer because they also happen to avoid the diseases, live longer and have more babies. They don't need to understand anything.
The point is that the itching evolved because it could be beneficial for us. The bites are not unpleasant in themselves as you say. They are unpleasant because we evolved to feel them unpleasant. It is the same as sex being pleasant. It is that way because it is beneficial.
Biting insects kill more people than any other animal group by miles, the reaction response is more or less the same in every mammal. Evolution doesn't evolve to anything, that's selective pressure.
This behavior predates humans as we know ourselves today.
Just my two cents, but if you see John getting bitten and then getting sick, and you see Mary getting bitten and then getting sick, you're probably going to think “Gee, seems like people get sick of those bites. Better cover my skin, huh?”
I'm pretty sure people have connected the two. While it may not seem like it on a day to day basis, people are pretty smart when there's enough of them and you give it some time.