Most DSLR lenses are not parfocal. This mean they don't hold focus as they zoom. They are not designed to because when shooting stills you don't zoom after focusing.
To make a zoom lens parfocal is very complex. This adds to the cost. This is one of the reasons cine zoom lenses are so much more expensive than DSLR zooms.
So there is nothing wrong with your camera or lens. This is normal behaviour for a DSLR lens.