Solution (application du commentaire de nmarkey)
    \documentclass[french,a4paper]{scrartcl}
    \usepackage[utf8]{inputenc}      % accents dans le source
    \usepackage[T1]{fontenc}         % accents dans le pdf
    \usepackage{ifthen}
    \usepackage{tcolorbox}
    \usepackage[french]{babel}      % titres et typo en français
    \begin{document}
    
    % 1 Extraire le titre de section:
    \makeatletter
    \newcommand{\titredesection}{\@currentheadentry}
    \makeatother
    
    % 2 Utiliser le titre comme condition:
    \newcommand{\titretcb}{%
    % Si la subsubsection est «foo», le titre est «bar»:
    \ifthenelse{\equal{foo}{\titredesection}}%
    {\tcbset{title=bar}}%
    % sinon le titre des tcolorbox est «foo»:
    {\tcbset{title=foo}}
    }
    
    % 3 Intégrer la condition à chaque appel de section - (erreur)
    %-\newcommand\sectionif[2]{\section[#2]{#1}\titretcb}
%-\newcommand\sectionif[2][]{\section[#1]{#2}\titretcb}
    
    \section{foo}
    \titretcb
    \begin{tcolorbox}
      Ici c'est une citation de bar.
    
      Le titre de cette box devrait être bar. 
    \end{tcolorbox}
    
    \section{bar}
    \titretcb
    \begin{tcolorbox}
      Ici c'est une citation de foo.
    
      Le titre de cette box devrait être foo. 
    \end{tcolorbox}
    \end{document}