I'm testing: GNU Emacs 29.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo
 version 1.16.0) of 2023-05-15

Dired behavior has multiple problems if subdirectories are present in the buffer and writable mode is entered and then cancelled

To reproduce the problem
1. Open a directory in dired
2. Insert a subdirectory with "i"
3. Enter writable mode "C-x C-q"
4. Cancel writable mode "C-c ESC"

Now the subdirectory is in the buffer, but it can't be folded or removed with "C-u k" and  the top dir files can no longer be accessed.  After playing around a while, I found that "g" (revert-buffer) fixes things, but it's not the most obvious thing to do.

On the plus side, at least I *can* enter writable mode with a folded subdirectory in dired now!

Peter