My previous test case was incorrect - in the detach -> merge -> detach operation, I didn't use the reference returned from merge as I should have. Seems like everything is working as it should here.