Very cool independent derivation of this trick. I first learned about it via factorial bases; I think that you’ve found Lehmer coding.
Thank you for linking these! I didn’t think that came up with this first, but I couldn’t figure out how to search for preexisting solutions. Lehmer code looks great. Cheers.