Here is a way by "redefining" section (To be clear didn't redefined that, but you can do it by changing just the definition \def\msection to \def\section)...
Everything is working as expected...
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{fancyhdr}
\let\oldsection\section
\makeatletter
\def\msection{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have optional parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[#1]#2{%
\oldsection*{#2}%
}
\def\@StarredWithout#1{
\oldsection*{#1}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\addtocounter{section}{1}
\oldsection[#1]{#2}%
}
\def\@nonStarredWithout#1{%
\addtocounter{section}{1}
\oldsection{#1}%
}
\makeatother
\begin{document}
\pagestyle{fancy}
\msection{Introduction}
\msection{First}
\msection{Second}
\msection*{Third}
\lipsum
\msection[Fourth]{long Forth}
\end{document}
Sorry (no screenshot on my pc right now ... I could add later one)
PS: From this old answer of mine.
\documentclassare you using? Do you want that for sections only or for chapters and sub(sub)sections? – Phelype Oleinik Jun 03 '19 at 09:22