Jesus didn't acknowledge Mary's family connection to him because the perceived significance of their earthly relationship would have affected his mission to love universally and unconditionally. Whenever we prioritise love for family, we give ourselves permission to withdraw love for others.
These two verses in John aren't the only times Jesus refused to acknowledge the significance of his genetic or family connections. In Mark, Matthew and Luke, when Jesus' family are waiting outside to speak with him, he rejects their connection to him by blood as a reason to put their desires above others:
And his mother and his brothers came; and standing outside they sent
to him and called him. And a crowd was sitting about him; and they
said to him, “Your mother and your brothers are outside, asking for
you.” And he replied, “Who are my mother and my brothers?” And looking
around on those who sat about him, he said, “Here are my mother and my
brothers! Whoever does the will of God is my brother, and sister, and
mother." Mark 3:31-35
In Luke, as a young boy missing for three days, Jesus refused to acknowledge any obligation to Mary and Joseph as their son:
And when they saw him they were astonished; and his mother said to
him, “Son, why have you treated us so? Behold, your father and I have
been looking for you anxiously.” 49 And he said to them, “How is it
that you sought me? Did you not know that I must be in my Father’s
house?” 50 And they did not understand the saying which he spoke to
Later in Luke, Jesus says:
“If any one comes to me and does not hate his own father and mother
and wife and children and brothers and sisters, yes, and even his own
life, he cannot be my disciple." Luke 14:26
What Jesus warns us to 'hate' here is not the people themselves, but the significance of our genetic or family connections, rejecting also the evolutionary 'instincts' that prioritise survival, continuation and advantage of our specific genetic code.
Therefore Jesus addressing his mother as 'woman' is consistent with his refusal to prioritise blood relations throughout the gospels.