Decades ago, MacOS properly had the close box for windows on the opposite side from minimize etc. widgets; now the one destructive window action could be reasonably safe without confirmation. Then Windows started gaining popularity and nobody ever did it the right way by default again. A pity for the sharp minds at Xerox PARC.
How is it more logical? Upper right places them close to the other window controls. Also continues the down-then-right order of most of the other controls.
In fact, putting buttons along either _side_ of the windows would be a better fit on the wider aspect screens we use nowadays.
Meanwhile gtk now puts those on opposite sides of the window title bar by default.