It's conceivable that such an aberration could be created if somebody said
mkdir /tmp/strange_dir
at a time when the filesystem was full (i.e., there were no free blocks).
It would still (probably) have been possible to create the strange_dir
directory entry in /tmp, because that would require only a few bytes of
unused space in one of the blocks already allocated to /tmp.
But it would have been impossible to allocate a block for strange_dir itself,
and therefore it would have been impossible
to create the . and .. entries. In such a case,
I would expect the mkdir program to remove (unlink)
the strange_dir directory entry in /tmp,
but software doesn't always do what I expect.
Other possibilities:
mkdir got interrupted (terminated)
between creating the strange_dir directory entry in /tmp
and creating the . and .. entries in strange_dir.
I would expect mkdir to catch the interrupt signal
(i.e., Ctrl+C) and clean up after itself,
but see above regarding software and my expectations of it.
And, of course, it cannot catch the kill signal or a system crash.
rmdir got interrupted (terminated)
between unlinking the . and .. entries in strange_dir
and unlinking the strange_dir directory entry in /tmp.
One might expect that the fsck that runs after a crash
would detect the strange_dir and do something about it, but ....
Yes, of course, if a directory has a size of 0,
that means that it has no blocks allocated to it,
and therefore it cannot have any contents
(not even little ones like . and ..).
I don't fully understand why cd .. would work when there is no ..,
but see the discussion in Removing a directory from inside
using the command line interface. It turns out that
mkdir /tmp/strange_dir
cd /tmp/strange_dir
ls -lai ← Shows normal . and .., with inode numbers.
rmdir /tmp/strange_dir
pwd ← Still reports /tmp/strange_dir
ls -lai ← Shows empty directory: Total 0
ls -ldi ← Shows . with the same inode number it had before,
but with a size of 0 and a link count of 0.
cd .. ← Puts you back into /tmp
This situation is not perfectly analogous to the one in this question,
because, in this other case, strange_dir is removed from /tmp.
But it suggests that cd .. is special, and sometimes works when there's no obvious mechanism by which it could.
Strange difference between pwd and /bin/pwd suggests a possibility
as to how this might work. The shell keeps track of your current directory.
That is, it keeps track of a best guess as to what your current directory is.
It con be fooled by symbolic links and tricks like
mkdir /tmp/foo
cd /tmp/foo
mv /tmp/foo /tmp/foobar
i.e., it will still think that the current directory is /tmp/foo,
and so that's what pwd will report,
but pwd -P and /bin/pwd will report /tmp/foobar.
So, it may be that, if chdir("..") fails,
the shell computes what it thinks your next-level-up directory should be,
and goes there absolutely.
(But I suspect that there's more to it than that.)