To check, how does this work exactly? Does X send the escape code to any window when pasting with middle click, and those which don't understand it just ignore it? And then once st has done the appropriate stuff with the pasted text, vim (for example) will detect that and behave as though :paste is enabled for the duration of the paste?
Sorry, I don't know X well.