It is theoretically possible with Marlin, but I don’t know of anyone (yet) who has set this up. Getting this up and running has been on my to-do list for some time, but I’ve spent a lot of time away from home (and therefore my machine) over the last several months.
The way most people use their machine is to 1) home the machine, 2) offset to a reference in the stock, and 3) reset the origin with a G92. The problem is that G92 resets the machine origin. Once it is reset, the machine loses its home position. Your machine no longer knows where (0,0,0) is in machine coordinates, so it does not know where to go to make bit changing easy, nor where to go to reset the bit Z after the change. You could home the machine again during a bit change to find the machine origin, but then you would lose the position of the stock.
The way to solve this problem is to use workspaces (G54 - G59.3). The use of workspaces allows you to preserve your machines coordinate system and have another coordinate system for your cutting. Setting your job up to use a workspace is more complicated, and there is a bug in the code (with a workaround). Jamie explores workspaces and the bug in this topic.
Not directly related to your question: when I see this kind of functionality, the company is usually selling some sort of “bit changing mechanism.” Near as I can tell, this mechanism is just a highly accurate switch, but they ask $$ for it. For example, Carbide 3D sells a Bitsetter for their Shapeoko for $120. This functionality could be done with a touch plate, but the user would always have to remember to attach the clip to the bit. I’ve seen on the forum a couple of touch-plate-like solutions, using off-the-shelf buttons like this. I don’t know how repeatable/accrate such solutions are. In theory, a bit-changing solution using machine coordinates would hit the switch at exactly the same place each time it was used and therefore the chance of an accurate measurement is much higher.
My understanding is that GRBL has more of this kind of functionality built-in, so hopefully someone with GRBL experience will chime in on this topic. There are tradeoffs with using GRBL vs. Marlin.
There is one other approach that should work. That is, use the g-codes for saving and restoring position to save the offset to the stock origin (See G60 and G61). I would only explore this approach if there were problems that could not be worked around in the use of workspaces.