(I'm not able to comment currently, or I would ask if you were trying to avoid cleveref before posting this. If you are, let me know.)
If your goal is just to get the output, and not specifically figure out how to combine commands like that, then I would suggest using the cleveref package, as what you describe is essentially reinventing the \cref command.
Also, because unless its functionality is modified somehow, using \nameref{thm1} is going to give you the name of the section containing your theorem (which I don't think is the goal).
Here's an example of your code with \cref:
\documentclass{article}
\usepackage{nameref}
\usepackage{cleveref}
% defines how the name for references to a single, and multiple
% items of the given type should be referenced
\crefname{theorem}{Theorem}{Theorems}
\newtheorem{theorem}{Theorem}
\begin{document}
\section{Section Name}
\label{sec1}
\begin{theorem}
\label{thm1}
Every section has a name.
\end{theorem}
By \cref{thm1}, this section has a name, which is \nameref{sec1}.
\end{document}
There is one line included to specify how the package should refer to theorems.
This package also allows you to specify formatting for the references:
% make references bold
\crefformat{theorem}{\B{Theorem~#2#1#3}}
as well as specifying what to do when two or more items are specified:
\newcommand{\crefrangeconjunction}{--} % placed between numbers in a range
\newcommand{\crefpairconjunction}{ and } % placed between two items
\newcommand{\crefmiddleconjunction}{ , } % placed between items in a list
\newcommand{\creflastconjunction}{, and } % placed before last item in a list
% specify format for two items
\crefrangeformat{theorem}{\B{Theorems~#3#1#4\crefrangeconjunction#5#2#6}}
% specify format for more than two items
\crefmultiformat{theorem}{\B{Theorems~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
Defining internal references
An example of the file from my thesis, which defined reference styles for everything I needed. (There's some difference between \Crefname and \crefname that escapes me right now.) Each block contains identical commands, the only difference being the type of thing they are for:
\Crefname{equation}{Equation}{Equations}
\Crefname{figure}{Figure}{Figures}
\Crefname{tabular}{Table}{Tables}
\Crefname{section}{Section}{Sections}
\Crefname{chapter}{Chapter}{Chapters}
\Crefname{appendix}{Appendix}{Appendices}
\crefname{equation}{Equation}{Equations}
\crefname{figure}{Figure}{Figures}
\crefname{tabular}{Table}{Tables}
\crefname{section}{Section}{Sections}
\crefname{chapter}{Chapter}{Chapters}
\crefname{appendix}{Appendix}{Appendices}
\crefdefaultlabelformat{#2\B{#1}#3}
\crefformat{equation}{\B{Equation~#2#1#3}}
\crefformat{table}{\B{Table~#2#1#3}}
\crefformat{figure}{\B{Figure~#2#1#3}}
\crefformat{section}{\B{Section~#2#1#3}}
\crefformat{chapter}{\B{Chapter~#2#1#3}}
\crefformat{appendix}{\B{Appendix~#2#1#3}}
\newcommand{\crefrangeconjunction}{--}
\newcommand{\crefpairconjunction}{ and }
\newcommand{\crefmiddleconjunction}{ , }
\newcommand{\creflastconjunction}{, and }
\crefrangeformat{table}{\B{Tables~#3#1#4\crefrangeconjunction#5#2#6}}
\crefrangeformat{figure}{\B{Figures~#3#1#4\crefrangeconjunction#5#2#6}}
\crefrangeformat{equation}{\B{Equations~#3#1#4\crefrangeconjunction#5#2#6}}
\crefrangeformat{chapter}{\B{Chapters~#3#1#4\crefrangeconjunction#5#2#6}}
\crefrangeformat{section}{\B{Sections~#3#1#4\crefrangeconjunction#5#2#6}}
\crefrangeformat{appendix}{\B{Appendices~#3#1#4\crefrangeconjunction#5#2#6}}
\crefmultiformat{table}{\B{Tables~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
\crefmultiformat{figure}{\B{Figures~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
\crefmultiformat{equation}{\B{Equations~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
\crefmultiformat{chapter}{\B{Chapters~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
\crefmultiformat{section}{\B{Sections~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
\crefmultiformat{appendix}{\B{Appendices~#2#1#3}}%
{\B{ and~#2#1#3}}{\B{, #2#1#3}}{\B{, and~#2#1#3}}
\section*), so it's not an issue for me. – Clement Yung Mar 31 '22 at 13:10\sectionor\section*in my MWE, since my question has nothing to do with section number. – Clement Yung Mar 31 '22 at 13:41\@currentlabelnameentry which is normally used for the counter name (section). – John Kormylo Mar 31 '22 at 16:38