I agree, Leica is safe … for the time being. And cameras like the Q [which almost certainly was designed in collaboration with Panasonic], may portend a change of direction for the company, or at the very least an attempt at a serious new branch in direction; one many would welcome given the positive reception the Q is getting. Niggles aside, the Q is almost exactly what a fully modern Leica should be, IMHO. Do more of this, Leica.
As to the rest, yes, Leica missed entirely the importance of the SLR by the late 1960s, and the reflex's desirability in the field gave it a serious leg up over the rangefinder, particularly when coupled with the excellent system support Nikon was building out around the F. That's where the tide really turned.
By the mid 1970s, the arrival of electronic control systems in cameras further tipped the scales to the Japanese manufacturers, because electronics know-how is directly in their wheelhouse. This trend simply increased exponentially into the world we live today, where the capture medium itself is now electronic.
Along the way that's been a tough place for a master of mechanical engineering to find itself. Partnerships with Minolta [and now Panasonic] notwithstanding, there's no question that Leica has played to the luxury / fashion set to raise revenues [why shouldn't they?], by touting "old-world" mechanical craftsmanship combined with rare earth elements and collectible editions. Not sure that's a strategy for long term success in the current photographic climate, however.
Through all of this, however, Leica's lenses have remained the single highest quality lineup on the planet. There's no denying that.
And to end where I began: Leica, put your engineering gears in overdrive and let's see an interchangeable lens version of the Q with one or two new state-of-the-art wrinkles, and with four or five good optics matched to it at a [relatively] reasonable price point. That would sell like hotcakes, IMO.