There is an opinion which says that there are four possible scenarios, and in only one is it regarded as haram (impermissible) for a man to shake hands with a non-mahram woman. These four scenarios are: when the one who is shaking hands does it for the sake of pleasure and finds pleasure in it; when he does it for the sake of pleasure but does not find pleasure in it; when he does not do it for the sake of pleasure but finds pleasure in it; and when he does not do it for the sake of pleasure and does not find pleasure in it.
Who is the author of this opinion? Does he belong to the Maliki madhhab (school of thought)?
In Mukhtasar al-Akhdari and other Maliki books there is an indication that it is haram to shake hands with a non-mahram woman according to the madhhab of Malik (may Allah have mercy on him).
‘Aleesh said in Minah al-Jaleel Sharh Mukhtasar Khaleel (1/22): It is not permissible for a man to touch the face or hand of a non-mahram woman, and it is not permissible for them to put their hands together without a barrier. ‘Aishah (may Allah be pleased with her) said: The Prophet (peace and blessings of Allah be upon him) never accepted the oath of allegiance (bay‘ah) of a woman by holding her hand; he would accept oaths of allegiance from women verbally. According to another report: His hand never touched the hand of a woman; rather he would accept their oath of allegiance verbally. End quote.
The details that you mentioned have to do with nullifying wudu by touching; wudu is nullified in the event of seeking pleasure, or finding pleasure (even if he was not seeking it), or seeking it and finding it. Wudu is not nullified when one does not seek pleasure or find it.
The prohibition is connected to doing it deliberately, whether there is pleasure or not.
And Allah knows best.