Q.summer squash
what would cause a plant that has produced yellow squash for months suddenly produce green?

Squash plants are notorious for cross-pollinating with one another. If you save your own seeds and you grew zucchini or winter squash in the same garden last year as you did your yellow squash, your green "yellow" squash is likely a result from cross-pollination with, for example, a zucchini.
The disease known as either yellow mosaic or squash mosaic virus turn yellow squash green, or appears as yellow and green mottling over the fruit. In addition, the foliage on the squash vine will likely have a similar mottled effect, and leaf veins may turn white.
https://www.gardeningknowhow.com/edible/vegetables/squash/how-to-grow-summer-squash.htm