fix order of reverse topologic iteration (#6728)
### Description
the ordering of reverse topological was incorrect. When pushing to the
stack we need to push items in reverse order to make sure they are
popped in correct order again.
Closes PACK-2116