If you add a layer mask to a layer and start painting in it to hide/reveal pixels, if you undo the first brush stroke, the Art Layer becomes selected (unselecting the layer mask), therefore, when you start painting again, you're painting on the Art Layer, not the Layer's Mask. Happening in Photoshop 20.0.0 on Mac OS 10.13.6