@claudeledu: You just saved my life!!! I have been searching for a solution to this problem for several months, to no avail. Today I just searched for "UIAlertController horizontal", and quickly came across your post (second result on Google).
Thank you so much!
As a side note, a customer 3 days ago reported that he was having this exact problem with my app, on macOS SEQUOIA.
So if it can help some developers to find it easier, I'm going to rephrase it for the search engines: this is a problem with menus displayed horizontally on macOS Sonoma and Sequoia. Menus in iOS apps are displayed horizontally on macOS Sonoma and Sequoia when they have more than 8 items. These menus on macOS Sonoma and Sequoia are horizontal, when they should be vertical. Got it, spider? :)