If you deal damage to an enemy below a tower you get targeted by that very tower. No exceptions.
It can be any AoE effect such as Bamis, Tiamat, Ludens (+ their respective upgrades and jungle item versions), a DoT through your runes or abilities, even a Braum E intercepting your AA's aimed at the turret (done this myself quite a few times).
I think this is a very clear rule that doesn't allow for any exceptions.
Is it just Bamis? What about getting attacked while you have Thornmail? Now maybe you would want to limit it to small ticks, as both these damage sources deal only a minimal amount of damage. But what about basic attacks then? As long as they deal less damage than the threshold, these wouldn't trigger aggro either? There is no elegant way to solve this except saying "item damage doesn't matter", and that is a stupid rule within the framework of the game.
That's why I think there should be no exceptions.
If you attack someone under a turret, you should be prepared to face the consequences. If you don't want to deal damage to them, then you should play around not getting aggro maybe? Just as they should play around to get the turret to target you - be it attacking you so they get damaged by Thornmail, going close to you to get burned, or even the Braum tactic I mentioned earlier.