Do I need to apply to the university that the main advisor is affiliated to?
It depends on what the rules of the host institution are. In brief: ELLIS offers an EU-wide central application portal and coordinates the matching process, but the official hiring process is local, governed by the institution of your main advisor.
If you are not yet working as a PhD student with an ELLIS Fellow or Scholar, but are a new student who wants to apply for a PhD as part of the ELLIS PhD Program, you would typically first apply through the ELLIS portal (but see below for important exceptions).
Each year, ELLIS Fellows and Scholars may sign up to recruit new PhD students through the centralized recruiting of the ELLIS PhD program. Students may select preferences for various advisors from the list of recruiting ELLIS Fellows and Scholars. Students and potential advisors are matched and the best students will be invited for interviews. If the student gets an offer, the student and two supervisors will sign a letter of intent which specifies the plans for funding, graduation and the exchange. However, ELLIS does not provide funding (except for smaller travel grants) nor does it award degrees. The ELLIS PhD Program is a meta program on top of existing graduate programs. I.e., you will be funded through your advisors' resources and the degree will come from a university. This means that all the official paperwork goes through the institution of your main advisor and you have to comply with all their rules. Consequently, new students must be accepted to the degree granting university in addition to being accepted as an ELLIS student (i.e., the acceptance to the ELLIS PhD program is a conditional accept).
After you accept the offer to become an ELLIS PhD student, you should ask your advisor which steps you have to take to become a student/an employee at the degree-granting institution (e.g. submitting documents, applying to the local doctoral school, etc.). Rules may vary depending on the institution.
*IMPORTANT* Some universities (e.g. University of Oxford) do not accept graduate students throughout the year, but have strict deadlines for applying to their graduate programs, which may be earlier than the ELLIS deadline. In this case, you should not wait until the ELLIS selection procedure has ended, but apply in parallel if you don't want to wait for the next deadline to enroll as a PhD should you get an ELLIS offer. If unsure, visit the website of the university or contact your preferred advisor. It's safest to apply to both programs in parallel to avoid any delays in the starting date of your contract.