I'm not sure if its illegal, but I'd find it highly impractical. The rear door would be way too short for me for normal use. On top of that, there's no stairs at the rear - how do you plan on getting in and out? A ladder doesn't sound like a great permanent solution, and you'd have to find room to stash a set of stairs.
It also changes your floor plan a bit - if you need the back door, then you can't have anything across the full width of the bus. A lot of people like to put the bed that way to save some space on their floor layout.
A few people on here have moved the stairs from the front of the bus to the middle - I think the Busted Flush in the short bus section is one of the most recent ones to do so.