One reason for poor backgrounds is the fact that when you're looking through your camera, the background is apt to be out-of-focus.
So, you don't pay much attention to the background.
Why is the background out-of-focus?
When you're looking through your viewfinder, the lens opening is wide open.
The lens opening stays wide open, until you press the shutter release.
With the lens wide open, you can see what you're photographing easily.
The aperture may be at f/4.5, for example.
Yet, when you press the shutter release, the lens opening may be different.
If it's a sunny day, the photograph may be taken at f/22.
The background will be much sharper in the photograph than what you saw in the viewfinder.
For example, the left photograph below is what was seen in the viewfinder.
The right photograph is the image that was saved to the memory card.
Because it was a sunny day, the camera chose f/22 for the lens opening.
Therefore, far more was in focus than what was seen in the viewfinder.
Many cameras have a depth-of-field preview button.
When you press the button, the lens opening moves from wide-open, say f/4.5, to where it will be when the shutter is released.
This feature is handy for judging depth-of-field.
When you press the button, the viewfinder may become quite dark.
You may not be able to see your subject clearly, but you can see the outline of the subject.
Press the button and release it, back and forth, to compare the depth-of-field.
Canon cameras have a feature called DEP which allows you to more easily adjust the aperture for more depth-of-field.