Patch #22 is still needed on the latest version of Drupal Core 10.2.6. I don't know why this is only cherry picked to 10.3.x? This is a necessary fix for all Drupal sites since it's now only checking the first menu item instead of any menu item.
Please re-open and add code change to 10.2.x as well, patch can be used in the meantime. (Until a stable version of 10.3.x is released for production)
This issue still occurs in my Drupal 10 page using Posts and Open Social. It happens with and without the AJAX comments module enabled.
Same exact use-case, upload an image to a comment on a post and it will be attached to a comment on the very first post of the page instead of the correct one (half-way down the page).
Have you found a solution? is this issue known?