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.
This is the way