ok to close the loop on this: a researcher looked into this in an article from 2022 called "Fatal Attraction: Loving the Guillotined Woman, from Washington Irving to Alexandre Dumas". the earliest instance of the story is from a pamphlet published in 1613!
that's helpful, thanks! I also found this as the source for the story in the 1984 book: “The Green Ribbon” is based on a European folk motif in which a red thread is worn around a person’s neck. The thread marks the place where the head was cut off, then reattached. so maybe it predates this?