I have realised the problem isn’t with the code I have posted and the issue is when the taxonomies are being created.
Basically the reason this wasn’t working is because the query_var parameter was set to false when registering the taxonomy. I changed this to true and my filtering started working.