You have the right attitude by staying committed to breastfeeding. My lo was easily distracted at 4months old (now 10 months old ) and I got creative to keep him on the breast. Here are suggestions from my experience and I hope this helps you.
1. Most important, nurse BEFORE solids for every meal. Solids are supplemental to nursing. So, your lo should be getting most of her nutrition from breastmilk. She is still learning about solid food and working her muscles and tongue to moving around the food in her mouth and swallowing. Try cutting back on portion size. Breastfeeding is the priority.
2. If you nurse before solids, it want be necessary to nurse right after solids too. Babies can associate negative feelings about nursing if forced to breastfeed.
2. While nursing, play some music or turn on some white noise to drown out any distracting sounds. Try dimming or darkening the room. Shutting the door is good only if your 4yo is ok. My routine is closing the shutters, turning on his noise machine, and getting him into his sleep sack which signals to him that we are about to nurse.
3. I like routine so I nurse every 4 hours at this age which helps stabilizes his metabolism. As he got older and more active, his appetite increased for breastmilk and I very slowly increased his solids.
4. My lo went through a phase of constant unlatching to talk or smile at me. I just smiled back and he latched back on. It is a phase but try not to encourage it to become a habit.
5. I hated hearing ththat it is a phase and trust your lo. You don't have this perspective unitl after the phase it over. If you keep breastfeeding first and solids second, your lo will be getting enough. She is happy, gaining weight, plenty of wet diapers, etc.
I hope nursing improves and youget some peace of mind.