The guy at the counter for the Bakery section took me to see the store manager, and she was very kind and considerate about the matter. After a bit of conversation with several other folks in the store, she told me that there seemed to have been an error on the dating of the product on the box, and she said that several other quarter apple pies were in the same condition, even though they had dates of "August 10th" on them. She apologised for any discomfort that I had suffered, and said that she would try to make sure that this problem never happened again. I filled in a relatively comprehensive form about the problem, and this was to be sent off to the Farm Boy head office and other places to make sure that this problem is cleaned up.
In the meantime, as compensation for the business with the tainted pie, the Farm Boy staff gave me a slightly larger apple pie without any sugar on it that is dated "August 12th" that was put out from a fresh batch as I watched, and a $60 credit voucher for product in the Farm Boy stores.
I think that everything was handled to my satisfaction, although I would have preferred that this whole incident had not happened in the first place.
Interested to hear what my fellow LJers think of the final results on this.