I am using i3-gaps for a desktop environment. I try to configure polybar to have file/edit/view... bar with a name of a focused app (like in a mac topbar). I am using Arch Linux.
There is no built-in functionality that could do this in polybar.
In theory, if there is some standard API that exposes information about the file/edit/view... menus for the currently focused application, you could write a script to emulate such behavior in the script module.
This however would not be a small task. You would also need a way to actually display the several menu layers (this cannot be done with polybar itself).