OK, we have used similar approach (workaround) some 10 years ago on a microcontroller that also missed this information from the HW.
But it was not that simple - we had to use several RAM cells to be sure that on power on the RAM does not match the value by chance. I think we used a 16-bit value first and we saw that sometimes the RAM cell is set to the key value by reset (uninitialized). Also we had to dig deeper in the toolchain because it was vendor specific and there was no simple way to disable RAM startup initialization (it was part of the startup code that was not available). So our entry point was the C main() and at this point our RAM keyword was already initialized to 0 ...
The trick with the XTALCTR and maybe additional RAM cell should be sufficient for this application.
Thank you!