Good question , teach should have been traveling alone , if I'm not mistaken the ace novel Blackbeard has too very strange moments there involving him ..but the main question is why teach would fight shanks back then ? Okay they are enemies, but if bb was solo , he wouldn't like to start catching attention, since his goal was stay in the shadows, and he continued it , shanks knew him since kid , but there's something off in this story , something that shanks perceived there in that meeting enough to use his scar on his flag , as maybe a reminder, btw he mentions in the novel his scar is not "itching" those days , and by itching is something similar like luffy and his scar in fishmen island when jinbei mentioned akainu to him , so maybe there's something personal behind it all.
Hope oda explain it someday.