First of all note, that option headwidth is not a single value but is an option with three values width:offset:offset as the manuals explain in Section 5.5. So asking for the value of the option will also show the three values.
KOMA-Script provides an experimental interface to ask for the current value of an option. The interface is currently not described in the manual but only the KOMA-Script homepage → Abfrage der gesetzten Optionen. Because this description is in German only, I've asked the KOMA-Script author to describe it at least in scrkernel-basics.pdf in English.
Command \KOMAoptionOf[<prefix command>]{<filename of package or class>}{<option>} can be used to ask for the current value(s) of an option. Because several KOMA-Script options provide more than one value, the result can not only be one value, but also a comma-separated list of values. The command is not expandable, so to use the value as argument of another command, the <prefix command> is used. Even for printing the value this can be needed. However this only shows the value of the option itself, so:
\documentclass{scrartcl}
\usepackage{scrlayer-scrpage}
\KOMAoptions{headwidth=textwithmarginpar:-\dimexpr\marginparsep+\marginparwidth\relax,footwidth=head}
\usepackage{url}
\begin{document}
DEBUG headwidth=\KOMAoptionOf[\url]{scrlayer-scrpage.sty}{headwidth}
\end{document}
just result in:

which is absolutely correct and indeed is the current value of option headwidth. However, it is not the length of the page head. So you cannot use it as a value of another length.
Also your usage of \leftmargin is wrong. \leftmargin is a LaTeX length used for lists. The current left margin of odd pages (or all pages in single sided documents) is \dimexpr \oddsidemargin+1in\relax. The current left margin of even pages is \dimexpr \evensidemargin+1in\relax.
And textwithmarginpar even isn't an option and far away from being a real length. It is a symbolic value to an option, nothing else but a string with a special semantic. However you can easily calculate it yourself. To show the value, you can use \the, even without using KOMA-Script:
\documentclass{article}
\begin{document}
DEBUG textwithmarginpar=\the\dimexpr\textwidth+\marginparwidth+\marginparsep\relax
\end{document}
So your whole question is based on false assumptions.
However, the current width of the page header indeed is an internal value of scrlayer-scrpage. Using an internal value is always a hack and could break whenever the internals change:
\documentclass{scrartcl}
\usepackage{scrlayer-scrpage}
\KOMAoptions{headwidth=textwithmarginpar:-\dimexpr\marginparsep+\marginparwidth\relax,footwidth=head}
\usepackage{url}
\begin{document}
DEBUG headwidth=\csname sls@headwidth\endcsname% WARNING: USING AN INTERNAL MACRO COULD BREAK!!!
\end{document}
would currently result in

A suggestion without using internals would be to calculate it yourself:
\documentclass{scrartcl}
\usepackage{scrlayer-scrpage}
\newlength{\myheadwidth}
\setlength{\myheadwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
\KOMAoptions{headwidth=\myheadwidth:-\dimexpr\marginparsep+\marginparwidth\relax,footwidth=head}
\usepackage{url}
\begin{document}
DEBUG headwidth=\the\myheadwidth
\end{document}
The result is the same as before.