Rue extractions very much tend to be aqueous-based without an intermediate non-polar phase so theoretically it is possible for heavy metals to precipitate as their hydroxides or oxides with sodium hydroxide (well, seeing as they come with the lye itself, they'll already be in that state) and then redissolve with the acetic acid.
Thus, repeated A/B cycles wouldn't do much to sort that out apart from the possibility that the alkaloids will dissolve in the acetic acid much more quickly than the heavy metals. That would still likely entail ultrafiltration of the acidic solution to remove really tiny amounts of metal (hydr)oxides. (Filtration of all but the most dilute of sodium hydroxide solutions is a horrendous idea.)
Most heavy metals would precipitate from a neutral solution with hydrogen sulfide but hydrogen sulfide is acutely
much more dangerous than the small amounts of heavy metals that would be present so this method is out of the question for anyone outside of a suitably equipped chemical laboratory.
You would need to assess a realistic upper limit of the likely heavy metals content of your lye as well as the subsequent alkaloid yield and apply that to your likely intake of harmala alkaloids. Would this figure exceed safe exposure limits for each individual metal concerned?
PS a Manske cycle or two would remove some proportion of some heavy metals as well.
If you were really concerned about the contamination it would probably be best to simply ditch your alks and start again with food grade lye. 30 grams isn't that much of a sacrifice (where I live that would be about 75 cents' worth).
Unless of course you feel like experimenting with vacuum sublimation of your freebase alkaloids.
PS a Manske cycle or two would remove some proportion of some heavy metals as well.
“There is a way of manipulating matter and energy so as to produce what modern scientists call 'a field of force'. The field acts on the observer and puts him in a privileged position vis-à-vis the universe. From this position he has access to the realities which are ordinarily hidden from us by time and space, matter and energy. This is what we call the Great Work."
― Jacques Bergier, quoting Fulcanelli