This is a useful feature to trim noise from json values, but unreliable while undocumented. So let's document the behavior:
json_strip_nulls doesn't make any promise regarding its output json other than that it is valid. Since we are munging the json we are arguably within our rights to output whatever transformed version we want. The format should not be documented.
If that's undesirable, let's remove the functionality - and provide a dedicated function for the task.
I agree we should at least provide a function that takes a json or jsonb and outputs its text representation in a minimalist form.
It's an interesting, and IMO, disappointing thread. Maybe we can do better now and focus on one missing capability the community desires and actually get something committed.