Mucus Plus Question 🤔

This question might seem a little dumb, but I'm a FTM. This is my first pregnancy after TTC for 2 1/2 years. With that being said, my fiancé worked a little late today and I was a bit overwhelmed so I decided to "relieve myself" by playing with myself a little. But halfway through it I was scared that it might cause a problem to my baby (I'm 5 weeks) but I was told that the Mucus Plug protects the baby, so I was just curious, when does the Mucus plug form? Does it form as soon as you get pregnant or what? Cause I'm really afraid of hurting the baby. I'd greatly appreciate any advice.Â