I think you have seen a very simplified view of that situation, likely provided by the opposing lawyers. J&J has agreed to give that company 2 billion dollars and the bankruptcy filing would, essentially, be forcing the lawsuit against them to be settled for 2 billion dollars and then, most importantly to J&J, the matter wouldn't be a concern for the future. They are trying to limit being perpetually sued for the same issue.
There's also the situation where the bankruptcy judge has to accept the situation, [1] which did not happen, twice.
[1] https://news.bloomberglaw.com/bankruptcy-law/j-j-is-left-wei...