Xcode 26 adds a new option (I think it’s new, I don’t have Xcode 16 anymore to check) that lets you indicate that a tab is pinned automatically which is exactly what the OP is looking for. But sadly Xcode 26 has a rotten regression that was fixed in an early beta and broken again in a later beta - as you open more tabs, the tab widths (all of them) get smaller and smaller so you can’t tell what file is in each. Horrible change.
I do recall that in Xcode 16, a tab automatically becomes pinned if the file is edited, or at least that was an option I had been using. That could explain the behavior the OP is seeing. Tabs get replaced if the tab had an unedited file in it. A new tab would be opened if the current tab had an edited file in it.
Topic:
Developer Tools & Services
SubTopic:
Xcode