I am going to start with devil fruit which shanks had (gomu gomu no mi) & devil fruit which teach wanted (yami yami no mi)
Even shanks’ conversation with marco “so ,you are 1st division commander phoenix marco” states that shanks and wb never clashed as “yonkos”.
I think that shanks(before being a yonko) had found a devil fruit Gomu Gomu no mi from a certain pirate crew somewhere in grandline(mostly new world).
And teach was already after Gomu Gomu no mi mistaking it for Yami Yami no mi,which he has seen in Df book.So when Teach arrived ,he found that fruit was already stolen by Shanks.So he planned to get the Df from Shanks & we know how evil planner teach is.
He joined the crew of Shanks crew (remember teach wasn’t a infamous pirate then ,he always leaved in shadow of WB). He managed to infiltrate the Red Haired pirates & waited for his opportunity ,as soon he got his hands on the Df, was caught by Shanks & at the same time he realised that df wasn’t Yami Yami no mi.
Now in order to flee he tried to fool Shanks in a meaningless talk ,while attacked shanks when his guard was down giving him a bloody scar on eye with his claw & managed to flee from there.
The reason Shanks scar still ached ,was he was done by the misleading personalities of Marshall D Teach.
I know this theory might have lot of flaws & I’m ready to accept them ,but this is just my thought
Thanks for reading ^^