The companies I worked for also had customers believe it or not, so they were the middle man. In fact the customers had customers and so on and so on, so some of the companies I worked for were in a long chain of companies before the final product was finished and delivered to the final customer, the product was usually an aeroplane.
If you sub-contract out to someone self-employed, then you are the customer of that self-employed person.