The Pirates of the Caribbean movies were in trouble even before Johnny Depp left, so Disney needs to learn from its biggest budget mistakes.