You are 2 steps away of getting rid of these weird behaviours...
brew install gnu-sed
ln -s /usr/local/bin/gsed /usr/local/bin/sed
I've wanted to set up that symlink for a while (it's annoying to always be modifying scripts to use gsed instead of sed) but I was worried some OSX system script somewhere would fail because it expected some OSX-sed-specific behaviour.
Have you noticed any of those types of problems since setting this up?
No, not yet.
But the issue I found is that you can't share script with mac community, but you can with the linux community. It's more a feature than a bug in my opinion!