“...is there anything that wards off the adults laying the eggs?”
It’s a fly if some kind that lays her eggs there, so your best defense is a row cover until that phase of that particular fly is over. Same works for anything in the Cruciferous family too, such as broccoli, cabbage, cauliflower, etc. They have the white/yellow Cabbage Moth that uses those plants as a host for their eggs. Hence, the green worms you sometimes have in broccoli. Ick!
You’ll have to see what the life cycle of that bug is, in your growing zone. The culprit is at the other link I sent you. It was an orange-backed fly of some sort. There were other ideas for prevention of Squash Borer there, too.
"A go-to outfit for gardening? Used scrubs from the thrift store. They're durable, have plenty of pockets and are easy to toss in the wash at the end of the day." ~ Garden Gate Magazine Reader Tip