Apply for a visa from the Thai embassy, or pay for a safe entry agent. The safe entry is going to be expensive though since you've already been denied entry.
Your layover is irrelevant. If you're denied entry, you will be forced to purchase a ticket to where the immigration officer decides. That will be one of 3 places, in this order of likelihood.
visas are issued by the MFA. The people who decided if you get into Thailand or not are part of immigration, a completely different government agency with different rules. The only thing a visa does is determine how many days you'll receive in your passport if you're allowed in.
Yes, they are one of the rogue offices, along with Koh Samui and Koh Phangnan that love to jerk people around. During low season you can usually get away with a week early at Jomtien but high season they get more unreasonable.
This isn't even a question. You CANNOT live in Thailand as a tourist. People are getting interrogated at the airport after leaving and returning 2 times back to back with an METV. Try it with 2 METV in a row and good luck on your flight back home after you are denied entry. This plan is simply not possible.
You shouldn't have any problems getting the non-B nor entering with it, but you MUST cancel your education extension before you leave. If you don't do that, there are multiple reports of people not being allowed to exit through land border because they didn't cancel their extension, reports of people not being allowed to apply for a new non-immigration visa because they didn't cancel their extension, and people not being able to apply for a new work extension in Thailand because they didn't cancel their education extension and then having to pay a fine of 500 baht per day for failing to do so.