In short, it is because Ruby's syntax is ambiguous, and because String#index accepts a regexp in its first argument.

There are different tradeoffs different editors take regarding regular expressions in Ruby. We can discuss improving Emacs's tradeoff in a bug report.