Jesus’ statements that he was bringing division yet pray for unity has to be understood as two seperate issues.
First, the division. Very simply put, the division Jesus was speaking about, was the split that would be caused by those who accepted the Good News He was proclaiming - that the Kinggdom of God was actively amoung them especially and uniquely in His person, and those who rejected this message. And this division would effect even families.
The unity Jesus prayed for was the unity amoung those who did accept His Good News. For me, I think this another example of Jesus’ insight into human nature and how this division amoung His followers was quite possible, maybe even probrable.