That is one of the things I'd like to figure out how to fix or at least minimize. I think the key is to make the path from Mic to headphone as short as possible. This means not only using the least amount of components (like the Garageband application) between input and headphones but also giving those components plenty of priority.
With 'giving priority' I mean: make sure that other applications that are running don't use so much processing cycles or have high (bursts of) disk activity that they hinder the application that is handling the microphone input.
The application handling microphone input should be able to run using the smallest possible internal buffer. Buffers are temporary storage buckets in memory (which is fast) to compensate for delays in the input/ output channels or other components of your computer.
Buffers cause delays. These delays are irritating if you're recording your own voice. A delay is perfectly fine for recording to disk: it really doesn't matter if the recording application is still writing the final bits to disk a couple of seconds after the recording stopped. Hence the trick is to have a big recording buffer and very small input buffers going in to the final mix. (The final mix is where all inputs come together to form the actual recording).
It's a nice challenge. Most applications don't allow you to change these buffer sizes and advanced settings. Then there is the Operating system that throws in some uncontrollable factors. A lot of trial and error work is required.