You're already 99% of the way there, you're just have the order of operations wrong.
What you're doing is sRGB -> linear perceived luminance space -> sRGB (greyscale, where R=G=B) -> dithering
When you should be applying dithering in the linear perceived luminance space, then covering the dithered image back into sRGB space.
It's not about order of operations; there is simply no linearization of sRGB happening or mentioned in the article.
I.e. it's not ordering of operation but absence of an operation that is the issue.
> ... -> linear perceived luminance space -> ...
"Perceptual" luminance is not a concept used anywhere. Luminance is, by definition, linear [1].
When we talk about color, something can either be linear or perceptual. Not both. "Perceptual" refers to "how humans perceive something" and the human visual system is non-linear.
Relative luminance [2] (what people refer to as grayscale) and what we're dealing with in the post, is still linear. So the order of operations is:
sRGB non-linear -> sRGB linear -> grayscale -> dither
After the dithering no conversion back to sRGB is necessary for the case at hand because all pixels are black or white and the sRGB transfer function for the inputs 0 and 1 has the outputs 0 and 1.
See also [3]. You only would re-apply a sRGB linear -> sRGB non-linear transform if you didn't dither to black and white after the grayscale conversion. I.e. in the case at hand: if you dithered the 8bit grayscale to n bit grayscale with 1 < n < 8.
[1] https://en.wikipedia.org/wiki/Luminance
[2] https://en.wikipedia.org/wiki/Relative_luminance
[3] https://en.wikipedia.org/wiki/Grayscale#Colorimetric_(percep...