What causes lemons to be bitter when cooked and how to avoid it?
You can try a few things.


Use just the zest from the peel, and then slice and remove the pith and use just the inside.
Pre-boil the lemon peels, then add them to your main dish.
Remove the lemons before the bitterness gets too strong (i.e. when you tasted the dish the first time) but while there's still a strong taste.


This works because the citrus oils (which are a major primary flavor contributor) are just in the top layer of the peels, while the acid is in the inside. The pith is just plain bitter.