I believe this is achievable through the API but that would take development resources. Additionally, I believe this may be possible if you subscribe to Operations Hub and build custom-coded solutions. These are a bit more advanced.
Here,here, and here are some community threads that might be helpful in those areas.
Alternatively, Insycle could help here. Full disclosure, I work for Insycle as a product marketer, but it solves this problem directly. You can bulk associate (add/remove/replace) using any field in your database as a matching field. This includes handling the more advanced features, including managing primary associations, labels, and parent-child hierarchies for companies. Additionally, you can insert association activities into your HubSpot workflows.