For Map Services published with unique assignment of Layer IDs, toggling on and off layers in the Layers Widget of the ArcGIS Online Operations Dashboard Map changes the layer in the 0-indexed position matching the unique ID rather than the layer assigned the unique ID.
In ArcMap, manually assign sequential, consecutive, layer IDs beginning with 0 (0-indexed) starting from the top of the Table of Contents (TOC) before publishing the Map Service.