I would think that marriage is just like a *thing* people do, and they are registered for purposes of like 'next of kin', but I'm sure the Federation has a much more fluid definition of 'next of kin', used only for medical and whatnot purposes. I'd find it likely that you could register anyone as your next of kin in case of emergency, like a best friend. They're definitely not getting married for tax purposes in the Federation, but I don't think the human-specific practice of marriage is going away just because it's not necessary in the legal sense. If our religions survive into the 23rd, they're likely to be more inclusive and more about the message rather than the rules and the dos and do nots. I feel like marriage as a practice would evolve the same way, where the tradition lives on but the dumbass rules, religious connections, and legal bullshit does not.
Anyway, I think when Michael refers to Stamets as 'widower' it was meant to be more poetic than anything literal like they were actually married.