As far as I know, file associations are declared by each app in the Info.plist file. macOS’s lsregister service reads that and registers the association in the Open with menu.
Rebuilding “Open With” can get rid of duplicates https://osxdaily.com/2013/01/22/fix-open-with-menu-mac-os-x/
Removing an app from the “Open With” menu requires editing the Info.plist file, which may invalidate the app's signature and render it unusable.