TL;DR to teach his disciples to believe in Him
In the account of walking on water in Mark, there is also a reference to Jesus being master of the elements (which links back to Job 38 as a sign of divinity). That sign of divinity is also demonstrated in Matthew 8 through a boat narrative.
"Who is this man, that even the wind and the sea obey him?" ~ Matthew
Jesus used this event in the boat to both demonstrate how important faith in him is, and to anchor that faith in his demonstration of divinity: control of the elements. This is referred to in both Mark and John.
46 And when he had taken leave of them, he went off to the mountain to pray.
47 When it was evening, the boat was far out on the sea and he was
alone on shore. 48 Then he saw that they were tossed about while
rowing, for the wind was against them. About the fourth watch of the
night, he came toward them walking on the sea. He meant to pass by
them. 49 But when they saw him walking on the sea, they thought it
was a ghost and cried out. 50 They had all seen him and were
terrified. But at once he spoke with them, “Take courage, it is I, do
not be afraid!” 51 He got into the boat with them and the wind died
down. They were [completely] astounded.
John 6 (NAB)
16 When it was evening, his disciples went down to the sea, 17
embarked in a boat, and went across the sea to Capernaum. It had
already grown dark, and Jesus had not yet come to them. 18 The sea
was stirred up because a strong wind was blowing. 19 When they had
rowed about three or four miles, they saw Jesus walking on the sea
and coming near the boat*, and they began to be afraid. 20 But he said
to them, “It is I.* Do not be afraid.”
In Mark, the wind dies down, whereas in John that isn't mentioned. In both, he is teaching his disciples to (1) have faith in him (2) and to not be fearful.
This gospel account is a point of departure for a variety of teaching. The most common themes I've heard in homilies over the years are that (1) it demonstrates Jesus' mastery of the elements (2) he is teaching his disciples about faith. (An example homily is at the link in the citation from Matthew).
From St Thomas Aquinas' Catena Aurea, commentary on Mark 6:
Glossa: The Lord indeed by the miracle of the loaves *shewed that He is the Creator of the world: but now by walking on the waves He proved
that He had a body free from the weight of all sin, and by appeasing
the winds and by calming the rage of the waves, He declared Himself to
be the Master of the elements.*
Theophilus of Antioch: Then by entering into the ship, the Lord restrained the tempest. For it continues, “And He went up unto them
into the ship, and the wind ceased.” Great indeed is the miracle of
our Lord’s walking on the sea, but the tempest and the contrary wind
were there as well, to make the miracle greater.
Are the above the limits of RCC belief or teaching? No, they are commentaries on scripture from early theologians/church fathers consistent with scripture (though the glossa appears to be either Aquinas' own interpretation, or that of an unattributed church father/theologian).
RCC Dogma is not necessary.
Jesus walking on water is not controversial. There's no need for a discrete teaching about why Jesus did that; it is explained sufficiently in Scripture.
Don't cherry pick Mark; check other Gospels for comparison
Scripture is pretty clear on the message being sent: (1) Jesus' divinity and (2) a vivid demonstration of the same to encourage his disciples to believe in him, and to not be afraid. (This encouragement to not be afraid would be put to the test after the crucifixion, but that's off topic for this question).