The code
\documentclass{article}
\begin{document}
$x_\mapsto$
\end{document}
results in the following:
Changing x_\mapsto to x_{\mapsto} does what one would probably hope, but I wonder: is this the expected behavior?
Yes, it's the expected behavior, because, after macro expansion, the input
x_\mapsto
is the same as
x_\mapstochar\rightarrow
Has it ever worked in the past? No, at least with 8-bit engines (latex or pdflatex), because \mapsto has been equivalent to the combination \mapstochar followed by \rightarrow from day one.
A similar phenomenon happens if you try
x_\notin
only worse because it raises an error.
Doing x_1,x_2,\dots,x_n is fine (and I use it all the time), but when the subscript (or superscript) is not a single character, all bets are off. Omitting the braces around a command used for a subscript can work or not and only knowing the internal meaning of the command can tell you.
The problem with x_\mapsto or x_\notin doesn't show up if you use LuaLaTeX and unicode-math, because in this case both symbols correspond to a single character. But it's not guaranteed to work with every possible command.
fontmath.stysays\DeclareRobustCommand\mapsto{\mapstochar\rightarrow}, and looking at that file one finds other commands for which the \mapstochar will get cut in situations like this.