Fix regression on after_commit in nested transactions. (master)

related to #16432 .

[fixes #16425]

This is practically a backport of that fix, plus 1 commit to make it work.

This is to ensure the same behaviour as 3.2
I had to change this as on the `commit` method (https://github.com/rails/rails/pull/16435/files#diff-52c8dd8e01c039c37b33b3fcbdfe406aL111) , the `current_transaction` on `transaction_manager` needs to be the parent already, so we need to pop the stack before calling it.