> Are you implying that public prosecutors have the option to not interact with criminal defense attorneys,
No, I'm implying that working for an actor’s counterparty compromises your ability to represent that actor in adversarial interactions with the same counterparty, which is a core function of unions with respect to employers as it is with defense attorneys with respect to prosecutors.
> companies certainly have the option to hire employees that do not work for unions.
Not in the US; even where union shops are prohibited by state right-to-work laws, adverse employment decisions on the basis of union membership or union-related activity by an employer are prohibited by the National Labor Relations Act. That is, in some cases, employers are allowed to hire employees who aren't members of a union, but they aren't legally permitted to hire employees because (even in part) they aren't members of unions.