That feeling you described toward the end, when you watch the life leave your dog. I went through the same thing with my cat. She had been with me for something like 10 years, I came home to her greeting me every day. I knew all of her quirks, her personality, the way she'd extend her paw out and stretch at me when I walked by, or coming into the bedroom at night to lay on us for awhile. She was a little black cat that turned invisible in the dark apart from her two yellow eyes. I always knew she'd die someday, and I always tried to prepare myself for it and say I gave her a good home and a good life, and I did. But when she started having trouble breathing one day, all that went out the window when I took her to the vet, hoping it was something we could fix. She had some kind of growth or tumor pressing on her windpipe, limiting her breathing, and every day she would be weak barely able to move a few steps across a room, much less keep any food down or drink enough water. It sucked, it all sucked. I searched for everything I could do, got second opinions from different vets, one suggested they could drain the fluid around her lungs and maybe extend her life a bit, that it wouldnt be painful, while another vet convinced me that putting her down was the best thing for her, and anything else would just make her suffer and be agonizing. Me and my girlfriend made the decision together, and I stayed there as the vet went to go get the needles for the final injection. And in that moment, my cat, who I had watched be weak and sick for the last 5 days, suddenly became very energetic, jumped up on the table and looked out the window and back to me, I saw some of the same life in her that was there a week back before this all started, but it was too late to change anything, we all had made our decisions, and the future was uncertain, so I sat there and held her, and cried like a bitch. When the nurse put the IV in, and then the needles. I felt her body jump for a second, and then all I felt was pain, I felt her life leave, and I felt like I was dying too, that so much of me had just died, that I let her die, that I killed her, that I could have done more, that I let this happen, I have never experienced a worse pain in my entire life. Every time I think back to that moment, I can remember it vividly and how it felt, losing someone I never understood the gravity of how much I cared about. My house felt empty too, every day for weeks. I never wanted to do anything anymore.
So believe me when I tell you this, I know just how you felt, how much death fucking sucks, and although I'm better than I was, I would gladly take any time travel sacrifice in a second if it meant being able to go back and change things for the better somehow. I don't know how long ago this was for you, but I hope you're doing okay too. It's hard, but it does get a bit better.