Horse do not do things to 'get out of work' or anything of the sort. They are either unschooled or in pain if they do not stand to be mounted;
I agree that horses do not do things because they want to 'get out of work'. But, you are dead wrong that they learn bad habits like 'not letting a person mount' ONLY because they are unschooled or in pain. One of the main reasons they do this is simply 'because they can'. The other big reason they do this is because people with good intentions get in their way and inadvertently 'cause' the bad behavior. This could be a person that inadvertently tightens the left rein every time they mount. Some, if not most horses, will learn to move their hip away as they are mounted. They are not unschooled or in pain. They are simply being taught the wrong thing. I can give you examples all day of people that think they are teaching a horse one thing while they are actually teaching them something else all together.
I have retrained enough of them and watched more than enough horses as they 'learned' some of these bad behaviors to know that many spoiled horses and many more horses with really bad behavior habits do them simply because they have done them before and want to continue to keep on doing them. Some horses will 'fight tooth and nail' to keep doing these bad behaviors. Others, just need effective correction and they develop the good behaviors very quickly.
With some horses, it only takes one time of a person NOT quickly correcting them for an unwanted bad behavior and they try to continue doing it every time they are in that situation. Other 'saintly horses' (usually older and kinder by nature), are much more 'forgiving' and let people do things badly many times before they finally need a 'tune-up' and some serious correction.
I have studied horse behavior for over 50 years and there is one thing that I take at face value without really 'knowing the reason' they do something. Horses like 'sameness'. So, when they are always handled competently and their handlers and riders never let them do anything wrong, they continue to behave that way unless there is a good reason for them not to. When they are allowed to go down-hill in their behavior, they try to continue doing things badly until they are given a really good reason to go back to doing them correctly. Some horses take a lot more severe correction than others. Some will go right back to the bad behavior when they get the tiniest opportunity and others stay 'honest' much easier. Some are inherently huge 'cheaters' while others are inherently much more 'forgiving and honest'. I am always looking for horses like the latter. They are the perfect horses for beginners. They are just hard to find.