Is there a way to extrude in a smart way?
As far as I know there's no magic button (like E) to extrude the way you want.

The simplest/fastest way I know is using Loop Cut and Slide in Face/Edge-edit mode (see picture).



It can become a very fast operation, if you get into the habit (see GIFs below).
Basically you use loop cut and slide to create faces where you need them and then you just move your face (instead of extruding it).



In this first situation I'm just hitting CTRL+R to start the "Loop Cut and Slide" command, I create one edge in the face and I slide it to the border, do the same in the other direction (to the other edge), then I select the face and I move it on the Z axis.



And here I'm doing the same but I do just one cut and slide it to the lower edge.