@jengland My guess is you'll need some kind of unchanging reference of a known length. For instance, two switches 'exactly' 500mm apart, and initally measured by some other means. You can then drive the carriage (or tool or, other part of the machine) into one switch, pull the current position from the object model and store it as a variable, do the same for the other switch and then compare the difference in position to your reference. If it differs by some amount, update the Steps/mm for that axis automatically.
Microswitches are cheap but might not be suitable because of their repeatability error. Maybe you'd want to create a switch using two conductive points, like some cncs use for tool offsets:
https://shop.carbide3d.com/collections/accessories/products/bitzero-v2?variant=32936948236349