I learned something new today - “local collections” should do what you want, although on a per-collection basis rather than per-object.
Look in n-panel → view tab → collections panel.
Local collection is off by default, so the viewport will defer to the global setup (which is whatever the outliner says) in that case.