There are two problems to solve:
Enforce that for every new vehicle type which is implemented (at design time), there must be also some code implemented which is able to produce a corresponding mechanic.
Enforce that at run time, if a mechanic object shall actually be created, it is the correct mechanic type which corresponds to the type of a given vehicle object.
The first problem is solved by the classic Abstract Factory pattern. It enforces implementers to create factories which can always produce both types of objects, vehicles and the corresponding mechanics.
For solving the second problem, one has to know precisely how and where in the whole code base "mechanic objects" are created. Ideally, one can centralize the creation in some factory method
mechanic = createNewMechanic(vehicle) // returns a corresponding mechanic
The centralized function for this then can internally use a map to find and call the correct factory object:
Map.of(Car.class, carFactory,
Bus.class, busFactory)
The factory objects (of which there will exactly be one per type in your program) may register themselves in this map when they are created by some generic implementation in their base class constructor. So this will make sure the map is kept up-to-date when new types of vehicles are added.
I am sure instead of implementing this kind of map and factory method by yourself, you could also utilize some DI container for this. I never tried it this way before, but I would actually be astonished if that's not possible.