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.
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.