Under- and over- seem to be prefixes with contrary meanings. But with the example of undertake and overtake, I don't see contrary meanings between them. Am I missing something?
By themselves, under and over are antonyms, but as prefixes the same rule doesn't always apply.
The prefix under has several meanings:
The prefix over also has several meanings:
Over and under are sometimes contrary prefixes, but only when they both refer to the same aspect of something. For example, one can overapply or underapply sunscreen depending on how much they use. In this case, over refers to its meaning of "excessively" while under refers to its meaning of "not enough".
Now, in your specific examples, these rules do not apply. Undertake is formed partially from German loan words, rather than from putting together two English words to form a compound. In this case,
Because of this, overtake and undertake won't have contradictory meanings.
The common meaning of overtake is to catch up with, or surpass.
Most common meanings of undertake involve taking on a task or obligation
The closest I can get to 'opposite meaning' is that undertake can be used in a motoring context, to mean "pass by another vehicle on the inside (nearest the kerb)" (normally one passes on the outside, nearest the centre of the road). I think that usage occurs in the British Highway Code, where it's specifically presented as bad practice (even on motorways where several lanes may actually be moving at much the same speed).
As the other answers indicate, 'overtake' and 'undertake' are not really antonyms.
Undertaking has a meaning 'person who manages burials (of dead people)'. I don't think I've ever heard anyone use 'overtaking' to refer to the opposite processes (whether that's managing a birth or grave-robbing).
In the context of driving, undertaking and overtaking are similar operations (moving past a slower-moving vehicle), and the oppositeness comes from which side of the vehicle you go past (and that, in turn, depends on whether your country drives on the left or the right of the road). There are grim jokes about undertaking (on a highway) leading to the undertakers.