I think there is just too much set up for Blackbeard to not be the final villain, considering his parallels to Luffy. Maybe Oda is pulling some indura and ashura shit, like sasuke and naruto teaming up to beat kaguya. That's been done before already.
Maybe they do team up on Imu at the start, but then it comes down to them at the very end. The Sun must defeat The Darkness to give birth to the new dawn. Blackbeard is not one to fight fair and square, so he at first may offer a ceasefire, and then strike at Luffy when he is at his weakest right after they beat imu or something.
When shanks loses to BB even if it's not in a "fair way" there is no rules to piracy, Luffy will have to grudgingly accept that Shanks lost to BB, so this whole notion of Luffy avenging Shanks doesn't seem right in the first place, if anything it might be disrespectful to Shanks to try and fight on his behalf, since Luffy respects him so much.
Therefore a reluctant alliance is possible and plausible, the Blackbeard pirates don't have to be the strongest to pose the biggest threat/be the final antagonists, they are they type to play their cards right, and snatch everything up underneath everyones noses, who cares if Imu is a powerful god when you can ally with the Sun God to beat him then simply kill luffy and take his devil fruit, maybe not even to use but to hold in stasis so no one else can become Joyboy, while he ushers in an era of darkness.