Changing doc.attrs?

Yes, an editor or transaction modifies the content of a given document node, not the document mode itself. That’s just how it’s defined. Putting in a different document node requires creating a new state.