BUG: replace with to_replace=Ellipsis raising TypeError (GH-50373) (#65946)