Is it best (for security) to install browsers via Flatpak or via a distribution's repositories on Linux?

Yes, depending on how strict the settings are set for the flatpak.

While JavaScript, especially JIT, is a big attack surface, you should still care about sandboxing, since there are still possible exploits in other components of the browser.