Distractions doesn't cause bad code, poor system design experience causes bad code. Programming is like any activity, once you're good at it, you can do it while doing other things. You can code while listening to music, watching a movie, talking on the phone. Provided you know what you're doing. If you have poor system design experience and have no framework for your current task, and you're pretty much experimenting, then you will easily fail especially when distracted, without noticing you're on the wrong path. However, if you have a unit of work to do, and a known framework to map it to, distraction won't cause you to lose sight of your goal, sure you might have a typo or even an incorrect logical cause, but I argue that those are minor and not bad code but mere and easy to fix mistakes.
Bad code is code that looks like good code, works, but is really bad because of poor design. Begins to show itself for what it is once it's time to modify and maintain it.