Currently, I'm in a hiring process of a company in Germany as a front-end developer, which is related to software development. The company's hiring process involves visiting the office for a few days and, during the visit, arriving at a decision on a job offer. The company has put me in contact with an agent who is handling the visa process. For the visit to the company's office, the agent registered an appointment for business visa two weeks ago. The appointment is scheduled in the second week of September. Additionally, there will be a wait of about 2 weeks to actually get the visa after the appointment.
Yesterday, the agent also registered an appointment for a work visa, because the queue is long and could result in a long wait in case of a job offer by the company.
My question: If on the visit, the company extends a job offer and I sign a contract while still being in Germany, can't I apply for a work permit and temporary residence permit from within Germany and wait for them to get approved? Is the exit and re-entry with a work visa even necessary?