I do wonder why override C though and not let that go to the RAM Disc because then the RAM Disc would at least survive the reset between switching M4 on and off. Pitty the RAM Disc wasn't aliased as |M though also as that would have been better than |C - for when we have another dozen drives in future...
In a CPC with no AMSDOS rom (slot 7). When booted the lowerrom setup all the firmware calls including the calls at &BC65-&BCA4 (Cassette functions).
So when you do file I/O those functions are called by the system (load/save/cat/run...) these functions will access the casette.
When AMSDOS is present. The CPC initializes as before, scans and inits roms 15-0 (CPC6128) when it comes to AMSDOS rom and jumps to its init function, it will overwrite the Casette functions.
All file I/O gets re-directed to AMSDOS rom. Notice the scan order is 15, 14, 13.. etc.
M4 rom does exactly the same as AMSDOS, if you place it lower than AMSDOS rom, it will replace the Cassette functions.
I don't know how the RAMDISC works, but if it supports basic file I/O, likely it does the same, hooking those functions and doing re-directions to AMSDOS.
Lastly you can put M4 rom in slot 8 or other place, it doesn't crash on my 6128+. Maybe you should erase your romslots.bin and romconfig.bin, if you had accidents with ie. chrome. Or you have other roms installed that doesn't like it.
And using slot 7 is vital to remain compatible with as many games as possible, because a lot do de-init all roms to save memory and then re-init rom 7 to have disc access. This is another problem you would have with using all 64 slots, you'd be using much of the ram for rom work areas and variables.