It's fine to set limits. I started off this pregnancy nursing two and my son weaned when the supply dipped. He was 3 yrs 9 months at the time. My daughter slowed down when supply was low but now that it's back, she's back to nursing more frequently. She's 2 1/2.
If he digs his knees and kicks, ask him not to. Gently hold his legs still and remind him that there is a baby in your tummy and you want him to be gentle. Your baby is very protected in there and nudges and kicks from your toddler won't harm it at all. No need to worry.
But nursing while pregnant can be uncomfortable. My nipples are extremely sensitive. I am very picky about latch. I now make my daughter open wide and watch as I guide the nipple in because otherwise she has a lazy latch and slurps the nipple in. OUCH! I just distract myself really well for the initial latch discomfort and then nursing is fine for the rest of the session. If I'm feeling really touched out I ask the nursling to finish up. I count to ten out loud in a silly voice and make it take about a minute. Then I announce ALL DONE. It works like a charm. Sometimes I use my finger to help unlatch the nursling but if there is resistance, I say "Let's do another 10 and then finish."
For me, I am willing to put up with some discomfort if I can find some coping mechanisms. But I also think that communication is important. When my daughter fiddles with my belly button and wants to nurse at the same time, I tell her to choose. If she can't choose, I make the choice for her. She may NOT play with my belly button while nursing and I will unlatch her if she doesn't stop playing with it. It's a good situation for discipline and learning personal boundaries. It's OK to not be an open milk bar and to set limits for a nursing toddler if it is causing you emotional or physical discomfort. Nursing while pregnant can be challenging, but you don't necessarily have to wean to deal with the discomforts.