I had the same challenge before. I think this part is really missing in the Pluggable Widgets API still. What I did was, based on the GUID you get from the datasource in the pluggable widget, retrieve the full MxObject via a call to the Client API. For this you need to load the Client API library into the widget. Can be done easily via npm.
Once you get the MxObject you can use add/removeReference functions to achieve what you need.
Not sure if there is a better solution out there, but this one is guaranteed to work!