Has been a long time since I made a ruffled pillow, but when I did, I remember having a problem with this too. I think I worked the ruffles around the corners by hand, and then pinned the excess fabric, it will overlap but the pinning helps keep it out of the way of the stitching. Once pinned, I basted it in place, then added the backing, and
sewed on the side where I could see the basting, and sewed around leaving an opening to turn. I did clip at the corners when done sewing to eliminate bulk. Hope that this helps.