That is the loophole. Technically, it is possible to hire an outsourced firm to do the work if it is 100% turnkey outsourced and done outside of Apple. You often see this type of outsourcing happen with legal and creative type work.
However, more often, the contractors are onsite and doing exactly what other Apple employees do and are managed by fulltime employees of Apple. In this case the law says those contractors should have been classified as employees of Apple not the contracting firm, even if their employment contract says otherwise. see Vizcaino v. Microsoft Corp