Une solution, très peu élégante.
```
    \documentclass{yathesis}
    \usepackage{chngcntr}
    
    \begin{document}
    \makeatletter
    \renewcommandtwoopt{\YAD@starred@chapter}[3][][]{%
      \booltrue{YAD@nonnumbered@chapter}%
      \boolfalse{YAD@nonnumbered@section}%
      \boolfalse{YAD@nonnumbered@subsection}%
      \boolfalse{YAD@nonnumbered@subsubsection}%
      \boolfalse{YAD@nonnumbered@paragraph}%
      \boolfalse{YAD@nonnumbered@subparagraph}%
      \YAD@setsecnumdepth{\YAD@secnumdepth}%
      \YAD@tmp@chapter[#1][#2]{#3}%
    }%
    \makeatother
    
    \chapter*{Test}
    
    \counterwithout{section}{chapter}
    
    \section{Test}
    
    \mainmatter
    \counterwithin{section}{chapter}
    
    % on redéfinit la commande comme dans la classe
    \makeatletter
      \renewcommandtwoopt{\YAD@starred@chapter}[3][][]{%
        \booltrue{YAD@nonnumbered@chapter}%
        \booltrue{YAD@nonnumbered@section}%
        \booltrue{YAD@nonnumbered@subsection}%
        \booltrue{YAD@nonnumbered@subsubsection}%
        \booltrue{YAD@nonnumbered@paragraph}%
        \booltrue{YAD@nonnumbered@subparagraph}%
        \YAD@setsecnumdepth{none}%
        \YAD@tmp@chapter[#1][#2]{#3}%
      }
    \makeatother
    \chapter{Test2}
    \section{Quoi?}
    \chapter{Test3}
    \section{Et alors?}
    \end{document}
```