@Rob ******
to answer your specifics, Thai immigration does not keep your passport, it goes with you. Myanmar stamps you in and out in one transaction.
If you use the same agent your TM6 (used for land / sea entry) is filled out at Thai leaving time and stays with the agent while you go to Myanmar and back, but rejoins you and your passport when you get back, before you get to the entry window Thai side.