Praise be to Allah.
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.
For more information please see the answer to question no. and 2459
And Allah knows best.