Not quite correct. For html, that is to signal standard compliance, you can leave it away and the browser will still handle it. For the bash one, all (most) shell scripts use .sh, so you need to give a shebang to tell the loader which executable (sh, bash, zsh, csh, …) to use
Also on Linux xdg does take file extensions into account, just executables do not
This would likely only hurt the end user. Many use chromium-based browsers, so you’re just driving those away.
You can detect Firefox, so you can do a superficial block in JS, but lemmy is such a simple site that you’d find it hard to find areas where there’s actual differences between the browsers, those usually only come from complex pages like video calling