Earlier, Jesus had noted the need to build upon a rock rather than on a sandy foundation (3 Nephi 11:40). He repeats that theme here, but defines what that rock is. Jesus has given them commandments of what they should do: “If ye shall always do these things blessed are ye, for ye are built upon my rock.”
Jesus had also declared that it was his doctrine that all should repent, and be baptized (3 Nephi 11:30–35). To the commandments of repentance and baptism, Jesus added the sacrament as a frequent reminder of those commandments, and of baptismal covenants. This was the rock. This was the foundation. When Jesus declared his doctrine, he also declared that his doctrine was the rock upon which their religious lives should be built.