I would advise you against allowing for hyphenation in the middle of inline code, because you run the risk of confusing your readers. If I were you, I'd reorganise the text a bit to make sure that no inline code sticks out of the right-hand-side margin.
If you're set on doing it anyway, I wouldn't follow your approach, though; it's a roundabout way of doing things. A simpler approach could be to
- eschew
\lstinline and the literate key entirely,
use a custom macro that applies the same emphasis style as the one in your listings:
\makeatletter
\newcommand\inlinecode[1]{{\lst@basicstyle\lst@emphstyle #1}}
\makeatother
load the underscore package (for more details, see this answer by diabonas), in order to allow for hyphenation after underscore characters:
\usepackage{underscore}

\documentclass{article}
\usepackage[textwidth=1.5cm,showframe]{geometry} % only for illustration purposes, here
\usepackage{xcolor}
\usepackage{listings}
\usepackage{underscore} % allows hyphenation after \_
\makeatletter
\newcommand\inlinecode[1]{{\lst@basicstyle\lst@emphstyle #1}}
\makeatother
\lstset{
basicstyle=\ttfamily,
emph={ABC, ABC_DEF},
emphstyle={\color{red}},
}
\setlength{\parindent}{0pt}
\begin{document}
\verb|\lstinline|:
\lstinline|ABC|
\lstinline|ABC_DEF|
\verb|\inlinecode|:
\inlinecode{ABC}
\inlinecode{ABC\_DEF}
\end{document}