No, there wasn't a rules engine to start with.
Karn doesn't force one, and the default deck I use for testing doesn't have any other cards that do.
Each exiledby effect card can store 36 owner/iid pairs, and it'll transparently create new effects as needed if you try to add more, so no, the only thing limiting it to 18 per player is the array size in
Karn Liberated's EVENT_RESOLVE_ACTIVATION handler.
The problem with the original bug is that you're calling reset_subtypes() on
all calls, including effect cards and in particular the effect card that the exiledby subsystem uses to record exiled iids, in recalculate_all_cards_in_play(). This changes the effect's targets[15].player from -1 (no iid recorded) to 0 (
Swamp); and exiledby_find_any() dutifully returns that.
You might also be calling reset_subtypes() or add_force_subtype_impl() on the effect card from other places. I haven't checked. Both should do nothing for effect cards.
It also looks, at a glance, like
Karn will only restore cards exiled by its current controller. Merits testing.