There is a very useful website called "Pee.ie
" where you will be able to find information on the many public toilets in Ireland. There is an excellent map on the website that makes it easy to plan a trip around the island while also factoring in stops.
Outside of public toilets, using the facilities in a local pub is another good option, yes.
I hope this information is helpful.