Well, I never advocate or suggest attaching a fence to a house. The fence and house will move independently and counter each other. I only install a post close to the foundation which is not close because of the foundation run under cement about 12 inches below the grade.
So, sink a post about 12 to 14 inches from foundation or home and then just butt up to home with railings then with pickets. BUTT UP only.
Now, termites, I would suggest that you use cedar, redwood, or treated fencing products that are not liked by termites.
Now, the other question. I am not sure I understand it, but I think I do. I like the tops of my fence nice and straight regardless of the grade or fall of the land. Where the land drops, you can add landscape timbers or even attach a 2 x 6 of treated wood all around the perimeter and then raise your fence a bout two or three inches from the earth. This raising of your fence will make your fence last soo much longer. Where the wood touches the earth and osmosises the moisture is where rot occurs first.
Then on your rails, cut them at an angle a slight angle all the way down the side of the rail. What your doing is creating a slide for the rain to shed off the rails and not pocket or pool at the intersection of the rail and the pickets. Very easy do do and very wise.
Hanging a fence is fun and exciting and one that you can do with your wife or someone else, one can set the pickets and do a every 10 level and the other hammer. It goes fast. Then if you don't want fastness, use prefabs, they are great.