In case you often face the task of creating a control sequence token via \csname..\endcsname, you can use TeX' #{-notation for defining a macro \name where tokens before the first opening brace are taken for an argument and where tokens nested into the first opening brace and the corresponding closing brace are taken for another/a second argument and where a control sequence token is formed from the second argument before TeX processes the tokens from the first argument.
I elaborated on the \name-macro in the thread Define a control sequence after that a space matters which was started at TeX - LaTeX StackExchange in November 10, 2016.
\documentclass{article}
\usepackage{tikz}
\makeatletter
\newcommand\name{}%
\long\def\name#1#{\UD@innername{#1}}%
\newcommand\UD@innername[2]{%
\expandafter\UD@exchange\expandafter{\csname#2\endcsname}{#1}%
}%
\newcommand\UD@exchange[2]{#2#1}%
\makeatother
\newcommand{\nodestuff}[3][]{%
\name\newcommand{#2}{%
\node[#1] (#2) #3;
}%
}
\begin{document}
\begin{tikzpicture}
\nodestuff[blue]{foonode}{{text at foonode}}
\nodestuff[blue]{barnode}{ at (2,3) {text at barnode}}
\foonode
\barnode
\draw (foonode) -- (barnode);
\end{tikzpicture}
\end{document}

In case you prefer to go the other direction, i.e., obtain the name from the control-sequence-token, you can have TeX apply \string and remove the preceding escape character if present. Be aware of edge cases like the value of the integer parameter \escapechar being 32/denoting a space.
Also the range of possible values where the integer parameter \escapechar yields producing a character token depends on the engine, i.e., depends on whether LuaTeX/XeTeX or "ordinary" TeX is in use.
\documentclass{article}
\usepackage{tikz}
\usepackage{ifxetex, ifluatex}
\makeatletter
\newcommand\UD@PassFirstToSecond[2]{#2{#1}}%
\newcommand\stringifysecond[2]{%
\expandafter\UD@PassFirstToSecond\expandafter{\romannumeral0\innerstringifysecond#2}{#1}%
}%
\newcommand\innerstringifysecond{%
\ifnum\escapechar=32 \expandafter\@gobble\else\expandafter\@firstofone\fi
% In case escapechar is 32, you get a space as escapechar, thus do nothing
% and have the space removed as terminator of the \romannumeral-expansion
% that currently is in progress.
{%
\ifnum\escapechar<0 \expandafter\@secondoftwo\else\expandafter\@firstofone\fi
{%
\ifnum\escapechar>\ifxetex 1114111 \else\ifluatex 1114111 \else 255 \fi\fi
\expandafter\@secondoftwo
\else
\expandafter\@firstoftwo
\fi
{%
% There is a non-space escapechar, thus gobble that escapechar
% as undelimited argument and insert space for terminating \romannumeral:
\@firstofone{\expandafter\expandafter\expandafter} \expandafter\@gobble
}%
}{%
% There is no escapechar, thus just insert space for terminating \romannumeral:
\@firstofone{\expandafter} %
}%
}%
\string
}%
%
\newcommand{\nodestuff}[2][]{%
\stringifysecond\innernodestuff{#2}{#1}{#2}%
}%
\newcommand\innernodestuff[4]{%
\newcommand#3{%
\node[#2] (#1) #4;
}%
}%
\makeatother
\begin{document}
\begin{tikzpicture}
\nodestuff[blue]{\foonode}{{text at foonode}}
\nodestuff[blue]{\barnode}{ at (2,3) {text at barnode}}
\foonode
\barnode
\draw (foonode) -- (barnode);
\end{tikzpicture}
\end{document}

Let's look at the special case of the nameless node/nameless macro:
Stringifying the nameless control sequence token which in turn can come into being as the result of the expansion of the expression \csname\endcsname or can come into being due to tokenizing a backslash character/a character of category code 0 at the end of a line while the value of the integer parameter \endlinechar is negative or larger than 255 (ordinary TeX and XeTeX; with LuaTeX attempts of assigning values larger than 127 to \endlinechar yield error messages and don't get carried out) yields a sequence of character tokens of catcode 12(other) \csname\endcsname.
%characters in your command – Apr 02 '17 at 15:41%right after the{of the\newcommanddefinitions – Apr 02 '17 at 15:52