You can't do assignments inside \csname...\endcsname. A good reference is What exactly do \csname and \endcsname do? and my answer to it where you find
It's possible to give many other interesting uses of this trick. But one should always keep in mind that TeX does complete expansion of what it finds in that context and that only characters must remain.
Since \addtocounter{mycounter}{1} relies on eventually doing \global\advance\c@mycounter by 1 it is not allowed in \csname...\endcsname.
If all you want is to have \foo behaving differently if followed by \bar or not, use \@ifnextchar:
\makeatletter
\newcommand{\foo}{\@ifnextchar\baz{\foobaz\@gobble}{x}}
\newcommand{\baz}{y}
\newcommand{\foobaz}{Hello world}
\makeatother
Note that \@gobble will remove the superfluous \baz token.
Complete example
\documentclass{article}
\makeatletter
\newcommand{\foo}{\@ifnextchar\baz{\foobaz\@gobble}{x}}
\newcommand{\baz}{y}
\newcommand{\foobaz}{Hello world}
\makeatother
\begin{document}
Separate: \foo{} and \baz.
Contiguous: \foo\baz
\end{document}

Here's a different approach with your \print macro:
\documentclass{article}
\usepackage{etoolbox}
\makeatletter
\providecommand\@secondofthree[3]{#2}
\providecommand\@thirdofthree[3]{#3}
\newcommand{\foo}{x\expandafter\@secondofthree}
\newcommand{\fuu}{T\expandafter\@secondofthree}
\newcommand{\baz}{\@secondoftwo{y}{z}}
\makeatother
\newcommand\bazz{Normal}
\newcommand\bazTy{Ops}
\newcommand\bazxy{Hello World}
\newcommand\print[2]{\csname baz#1#2\endcsname}
\begin{document}
`\print{\foo}{\baz}'
`\print{\fuu}{\baz}'
`\print{}{\baz}'
\end{document}

The macro \print{\foo}{\baz} becomes
\csname baz\foo\baz\endcsname
and, expanding \foo.
\csname bazx\expandafter\@secondofthree\baz\endcsname
Now \expandafter causes the expansion of \baz and disappears
\csname bazx\@secondofthree\@secondoftwo{y}{z}\endcsname
where the expansion of \@secondofthree selects y, giving
\csname bazxy\endcsname
When \print{}{\baz} is used, we have
\csname baz\@secondoftwo{y}{z}\endcsname
and \@secondoftwo selects z, giving \csname bazz\endcsname.
One can install an abstraction layer that eventually does the same, but makes definitions easier:
\documentclass{article}
\usepackage{etoolbox}
\makeatletter
\providecommand\@secondofthree[3]{#2}
\providecommand\@thirdofthree[3]{#3}
\newcommand{\newprefixcommand}[2]{%
\newcommand{#1}{#2\expandafter\@secondofthree}%
}
\newcommand{\newalternatecommand}[3]{%
\newcommand{#1}{\@secondoftwo{#2}{#3}}%
}
\makeatother
\newcommand\print[2]{\csname baz#1#2\endcsname}
\newprefixcommand{\foo}{x}
\newprefixcommand{\fuu}{T}
\newalternatecommand{\baz}{y}{z}
\newcommand\bazz{Normal}
\newcommand\bazTy{Ops}
\newcommand\bazxy{Hello World}
\begin{document}
`\print{\foo}{\baz}'
`\print{\fuu}{\baz}'
`\print{}{\baz}'
\end{document}
{}after\foo{}and\bar{}– Dec 28 '14 at 10:22\empha good thing to put inside\csname. What do you really want? – yo' Dec 28 '14 at 12:05\emphinstead of the counter stuff I actually have there. Causes the same message (and what I really want is that message not appearing anymore), but is confusing to the reader. Modified it accordingly. – user66554 Dec 28 '14 at 12:49\csnameand\endcsnamedo?, in particular the passage “It's possible to give many other interesting uses of this trick. But one should always keep in mind that TeX does complete expansion of what it finds in that context and that only characters must remain.” – egreg Dec 28 '14 at 13:28