It's such a simple problem to solve too: when there are too many menu bar icons, put them in an overflow menu. A single icon which contains a list of icons. And let me arrange which icons go into the top bar and which go into the overflow menu.
Windows solved this many many decades ago with their system tray overflow menu. Browsers solved it too, by letting you put extension icons in an overflow menu. It's not hard.
But nooo, macOS just silently hides applications from you, with no visible indication that there's anything hidden.
An even simpler solution is allow horizontal scrolling in the area.
Even if they didn't want to have an overflow menu for some reason there it boggles my mind why the menu bar isn't just aware of what portion is covered and should be skipped (file menus or icons) in the first place!