The error is because \textbackslash is a text command to typeset a backslash, not "the backslash character". Being so it contains font selection commands and many other things that make the string comparison choke. You're using expl3 syntax anyhow, so you can replace \textbackslash by \c_backslash_str, which is "the backslash character". Change this and the ...
Another simple way, beside the suggestions in the comments, is to use the e-TeX primitive \scantokens around the verbatim code in your macro defintion: