I have publication A and child publication of A is B. We have written a TBB which publishes page in B when published from A. Now we need to publish page in A (parent), when page is published from B without TBB again triggering publish of page from B (causing infinite publishing).
Instead of creating tbbs for managing publishing, i suggest using event system. It is much more elegant solution. You can manipulate objects via event system more easily and will have more control over different publishing stages. You can also log everything relevant to your issue and debug more easily.
Not that this sounds like a particularly good idea but - are you sure you're not publishing with "publish child publications" checked?
Also - you'll have to catch (using the Event System - which would be generally more manageable and visible that using TBBs for this type of extension) when someone manually publishes from A and selects Publish in Child Publications to either
- deselect the option when a user selects it
- deselect the option and take account of specific publications (in your scenario here just b?) that would otherwise trigger a Parent Page publication
Take note of this second scenario - you could just replace that whole long sentence with Potential Nightmare Situation depending on your Blueprint structure (