I don't see any inequity here. Consider these play situations.
1. B40 catches a punt in his end zone and is downed there. During the run by B40 B88 holds at B-10. Result is 1/10 for team B at B-5.
2. B40 catches a punt in his end zone and is downed there. During the run by B40 B88 holds at B-30. Result is 1/10 for team B at B-10.
3. B40 catches a punt in his end zone and runs out of bouds at B-20. During the run by B40 B88 holds in the end zone. Result is safety.
4. B40 catches a punt in his end zone and runs out of bouds at B-20. During the run by B40 B88 holds at B-10. Result is 1/10 for team B at B-5.
5. B40 catches a punt in his end zone and runs out of bouds at B-20. During the run by B40 B88 holds at B-30. Result is 1/10 for team B at B-10.
For scenario 3 allow me to edit the question for a few other scenarios I would theoretically change enforcement for:
A) B40 catches a punt in his end zone and runs out of bouds at B-45. During the run by B40 B88 holds in the end zone.
Result: I would rule enforcement from the B-20 as foul occurred in EZ (touchback succeeding spot), 1/10 B at B-10. Rationale B did not put ball in EZ.
B) B40 catches a punt in his end zone and downs it in the EZ. Before downing the ball by B40 B88 holds in the end zone.
Result: I would rule enforcement from the B-20 as foul occurred in EZ and (touchback would be same succeeding spot), 1/10 B at B-10. Rationale B did not put ball in EZ.
C) B40 catches a punt in his end zone takes it out to the B5 before returning to EZ and is tackled (or downed, OR tackled at the B-5 or A-30 or wherever). During the play B88 holds in the end zone.
Result: I would rule safety 2 points for A. Rationale B put ball in EZ during the play.
Complicated, Yes. We have no such other complicated rules in the book right?

I have no issues with the other scenarios listed. My biggest issue is punishing B for making a great play and punishing them for making instinct plays (fairly or not) and not having the ability to control where the ball is.
Besides, why is B allowed to walk out of the EZ (or tackled out) after a change of possession in their EZ and be rewarded with a touchback? A doesn't get this benefit (understandably).
If we punish B for a foul in the EZ after a change of possession when they have seconds to make a play, why not punish them for walking out of their own EZ with the ball (or tackled out) when they have the same amount of seconds to think about it?
We have many change of possession exceptions. Why not this one as well?