As crazy as it seems, I believe Shanks unwillingly helped Teach there, and only went to warn WB out of his good nature, nothing else.
If you think about it, Shanks's entire post-Dodger journey isn't just about preserving whatever this "balance" is. It was about sacrificing to forge the ultimate weapon against Imu. But what if Teach was also part of his plan alongside Luffy? Shanks' two major wounds thus far were caused "becaus of" Luffy and Teach.
After witnessing Harald's death and the many deaths caused by the World Government, Shanks prioritized taking down Imu above all else. When Teach gave him his scar, Shanks recognized his potential, Teach possessed a unique ability to match Imu's power that only Shanks knew about. This made him act like a Severus Snape, to forge a necessary evil to take down Imu.
- By intercepting Kaido before Marineford, Shanks prevented a three-way war that could have prevented Blackbeard from stealing the Gura Gura no Mi. Kaido might have even sided with WB.
- When Shanks subsequently arrived to end the Summit War, his intervention equally saved Luffy from Akainu, and Teach, who was not in a position to take on the entire Marines, at once.
- Years later in Wano, Shanks stopped Ryokugyu, while this can be interpreted as something that saved Luffy only, it also protected the overall balance of power, Kaido and Big Mom were just taken down, If Luffy was killed too then Teach would've been left alone against the government. The trope of Teach and Luffy unknowingly helping each other was also seen back ever since Impel Down.