Absolutely not. Excellent question.
Several people I know are pros now who used to do fanfic. I doubt if their publishers know, in most cases.
i think there are probably real benefits to writing fanfic if your goal is to go pro someday. The practice, the draft, the critiques you might get, that could all be very helpful.
you just have to put it away when you are ready to start submitting.