My older cat was weirdly inconsistent with her litter box usage: absent of health issues, she would start excessively peeing outside of her month roughly once a year
It was a nightmare!
Ultimately I took a gamble that she just didn't love using litter. So I started putting puppy pads into empty litter boxes and she was suddenly, consistently faithful to her box
Enzyme cleaners worked to make sure the old spots didn't attract her, and puppy pads were not quite as convenient (I flushed the poop and threw away the wet pads), but it was sooo worth not having to worry that she'd stray from her box again. Just something to consider
I agree that I would not see caging as a solution