When to refactor your codebase.
Not to be confused with refactoring code. The codebase is how the code and its dependencies are structured to make future additional upgrades easier, and makes the entire code readable.
A bad codebase design will make additional code or modification hard. A good codebase structure on the other hand promotes better understanding among other members of the team.
Now the problem, you've to get onboarded, they've introduced you to their codebase, then after you've understood how it works, you've realized the flaws, and what the structure should look like ~ based on how you think it should be.
However time can't give you a chance because you'll be partaking into different project, and refactoring a large codebase is not an easy feat.
It should always need to be planned at the very start of the project.
What can you do?
If situation permits, refactor the code, but it will most of the time it will become impossible since time costs businesses money. Instead, you can start best practices in the codebase design starting from the latest version of the working code. This will help future team and you lessen the technical debt.
Remember the progress is more important than a perfect work, it can hinder progress by setting unrealistic standards.
Although never deprive your project of best practices given that the situation permits!