Yes, of course they go through pain due to cancer.
Get out of your head and listen to your heart, and you will know when he is ready for help to leave his body. Dogs aren't like us - they don't fear death. When the pain gets severe, they just want to leave their physical body and go on to the next stage of life.