A leaning motorcycle is not flirting with disaster; it is solving a geometry problem. At speed, the machine must tilt so that the combined center of mass of rider and bike sits exactly over the line of the resultant force: gravity downward and centripetal force toward the inside of the turn. That net vector passes through the tire contact patch, so the bike is not defying balance at all, it is quietly aligning with it.
The real trick is that motion manufactures its own stability. As the wheels spin, their angular momentum and gyroscopic precession resist quick changes in orientation, so small wobbles are damped instead of amplified. Higher speed means larger centripetal force for a given turn radius, which demands a larger lean angle yet also gives a wider stability margin, because tiny steering inputs automatically create the exact inward force needed to keep the center of mass supported.
The slow, upright motorcycle is actually in the more precarious state. At walking pace, centripetal force is almost absent and the wheel gyroscopes are weak, so the center of mass must sit directly above a contact patch that is only a few centimeters wide. Any slight lateral shift generates a torque with almost no dynamic counterforce, forcing the rider to make rapid steering corrections or put a foot down as gravity abruptly wins.