Turning my comment into an answer: If you don't need comments inside of the body of tabularx you can turn the % char into a character which can be input directly. If you need comments you can turn another character which you don't need there into the comment char with
\category`\<char>=14
Just replace <char> with a single character which should be the comment character. In the example below I used # for the comments inside of tabularx:
\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\begin{document}
\verb|b%a|
\begin{tabular}{l l}
\verb|b%a| & a
\end{tabular}
\begingroup
% use `%' as a normal character and `#` as comment character
\catcode`\#=14
\catcode`\%=12
\begin{tabularx}{\linewidth}{l X}
\verb|b%a| & a \\ # this is a comment
\end{tabularx}
# \endgroup ends the scope of our category changes, so afterwards `#' is
# again the parameter character and `%' the comments character
\endgroup
\end{document}

tabularxthe body of the environment is already read and therefore tokenised. The category code changes of\verbcan't be applied inside of it. Therefore, you'd have to change the catcode of%before the\begin{tabularx}, this means that you can't put comments there, too. You could do so by putting\begingroup\catcode\%=12prior to the\begin{tabularx}and\endgroupafter\end{tabularx}`. – Skillmon Jul 08 '19 at 15:50tabularx: Since Version 1.02,\verband\verb*may be used, but they may treat spaces incorrectly, and the argument can not contain an unmatched{or}, or a%character. – egreg Jul 08 '19 at 16:01\texttt{b\%a}why\verb? – David Carlisle Jul 08 '19 at 16:28\verbto avoid the need of escaping all those %s etc. in the code code extracts that I was pasting, but you're right of course, I did end up using\ţextttthen. – Bastian Jul 18 '19 at 16:28