Update:
Since KOMA-Script version 3.31 option dynindent can be used in the optional argument of \DeclareTOCStyleEntries:
\documentclass[english]{scrartcl}[2020/07/22]% needs version 3.31 or newer
\usepackage{blindtext}% only for dummy text
\usepackage{babel}
\usepackage{xparse}
\usepackage{calc}
\newcommand\useprefix[2]{#1#2}
\NewDocumentCommand\appendixprefixintoc{}
{%
\DeclareTOCStyleEntry
[%
entrynumberformat=\useprefix{\appendixname~},% add the prefix before the entrynumber
dynnumwidth
]{default}{section}
\DeclareTOCStyleEntries[%
dynindent
]{default}{subsection,subsubsection,paragraph,subparagraph}
}
\newcommand{\appendixmore}{%
\renewcommand{\sectionformat}{%
\appendixname~\thesection\autodot\enskip}%
\renewcommand*{\sectionmarkformat}{%
\appendixname~\thesection\autodot\enskip}%
\addtocontents{toc}{\appendixprefixintoc}%
}
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}
Run three times to get the same result as in my original answer (see below).
Original answer:
Here is a suggestion that needs KOMA-Script version 3.27 or newer:
\documentclass[english]{scrartcl}[2019/10/13]% needs version 3.27 or newer
\usepackage{blindtext}% only for dummy text
\usepackage{babel}
\usepackage{xparse}
\usepackage{calc}
\newcommand\useprefix[2]{#1#2}
\newlength\appendixprefixwidth
\NewDocumentCommand\appendixprefixintoc{}
{%
\setlength\appendixprefixwidth{%
\widthof{\usekomafont{sectionentry}\appendixname~}}% measure needed additional space
\DeclareTOCStyleEntry
[%
entrynumberformat=\useprefix{\appendixname~},% add the prefix before the entrynumber
numwidth+=\appendixprefixwidth% enlarge numwidth for level section
]{default}{section}
\DeclareTOCStyleEntries[%
indent+=\appendixprefixwidth% enlarge indent for other levels
]{default}{subsection,subsubsection,paragraph,subparagraph}
}
\newcommand{\appendixmore}{%
\renewcommand{\sectionformat}{%
\appendixname~\thesection\autodot\enskip}%
\renewcommand*{\sectionmarkformat}{%
\appendixname~\thesection\autodot\enskip}%
\addtocontents{toc}{\appendixprefixintoc}%
}
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}

– haver Nov 08 '19 at 16:371. A Section Appendix A. A Section in the Appendix A.1. A Subsection in the Appendix Appendix B. Another Section in the Appendix