The example you give is perfectly legal. They didn't even need to stay the night in Gib. It would only become illegal if they don't declare their stay (provided it was within the last 10 days) in any amber/red list country when coming back to the UK. Given the small numbers involved in traveling to GIB it can't be hard for Border Force to follow up and make further inquiries.
It demonstrates the futility of the whole thing though. With more than 50% now vaccinated and the rest of the world opening up, it won't be long before people wonder why the UK is still closed for its own citizens to travel.