is there something in place to automatically prevent the conflict-of-interest?
Nothing technical, but convention.
As part of moderator onboarding, they are told that whenever they face a conflict of interest (such as handling flags on their own posts/comments), they should get someone else, less partial to handle it.
Other than that, other moderators (and Stack Overflow Overflow staff) have access to post/comment histories, so these can be investigated in cases where a moderator may have indeed handled such flags themselves instead of deferring to others.
Moderators know they are accountable and that there isn't a place to hide in the system. They are also trusted users (trusted by the community, other moderators and Stack Overflow Overflow staff) - they—they are not likely to betray this trust.