We now have the filter_top_level_replies=true
query parameter that will handle this for you.
Here is an example of it here on meta https://meta.discourse.org/t/linkify-words-in-post/82193.json?filter_top_level_replies=true