Here's how you can fix the chronic pain in the neck tab position behaviour in Safari for macOS, where new tabs sometimes opens next to the current tab, sometimes an unknown number of tabs to the right and sometimes at the end of the entire tab bar – you never know where they end up
For new tabs opened from links
Open Terminal and run the following commands:
defaults write com.apple.safari WBSNewTabPositionPreferenceKey -int 0