I played around with this quite a bit this morning, both client side and with full access to my IMAP server and its settings, and it seems that the reasoning for this request on the part of Mail lies in Mail's overall display design:
If you want subfolders in your mailbox per account, they need to be in a completely different part of the folder list than the Inbox. It is as simple as that. Every other mailbox-analog design idea lies within this overarching theory.
This is the reason your folders seem to "disappear". They're likely not completely vanished, but rather just much farther down the list under a top-level hierarchy named after the account to which they belong. So, your Inbox for that account, for some unknown and unreasonable reason, is up with your other accounts' inboxes, and every folder "under" that inbox in IMAP is way down the list in a cluttersome, top-level-per-mail-account jumble-f
*.
So, to that end, if you want your Tasks etc. to save to the server, then Mail requests over and over that you make your mailboxes appear in this way, aka setting your IMAP Folder Prefix to "INBOX" usually, thus being able to separate your folders in the haphazard method in which Mail prefers. I expect this is the only way it knows how to read and write from those folders as well, even if you created them on the server yourself. I am however unwilling to test this out, given another experience I had with this system:
NEVER ever delete the calendar that Mail creates in iCal for this integration. I had this bind up the entire related account for some undetermined amount of time as it tried and failed over and over to come to grips with my apparent vile indiscretion. I don't recall what I did to fix this beyond rebuilding my mailbox and being very very patient.
I'm happy not using this half-baked Tasks-to-server system "convenience" for the tradeoff that my accounts appear where I want them and how I want them, without having to fit into the mold of whoever designed this kludgy, disjointed and embarrassingly counterproductive UI scheme. I suppose it works for someone with one, maybe two mailboxes, and that is likely the system under which this was tested.
Bums me out.