No, it does not follow.
Mostly, because that's not what is actually happening with sanctuary cities. First, there is no actual definition of a sanctuary city, neither in the law or, more specifically, in immigration policy.
Here's what happens in sanctuary cities. Section 1373(a) of Title 8 of US Code states that local and state governments are prohibited from enacting laws or policies limiting the exchange of info re: citizenship w/Department of Homeland Security. So if you work for the local Department of Human Services, and someone shows up to sign up for public benefits and you find out they are undocumented immigrants, if you wanted to report that person to ICE, no government could forbid you from doing so. Conversely, the federal government can't force you to report that undocumented immigrant.
Likewise, the detainers that ICE issues, which are requests to the local government to inform them when a given undocumented immigrant is to be released, are not mandatory. If that action is taken, the jail can hold the undocumented immigrant up to 48 hours for ICE to act. If ICE doesn't act, the person must be let go.
A report by the DOJ's inspector general looked at a random sampling of cities that receive federal funding and found that each of them had certain policies in place that limited cooperation with ICE and ICE's detainers. However, the same inspector general found that Section 1373 is not applicable to detainers. In sum, the IG determined that, although there were no explicit policies forbidding state or local employees from cooperating with ICE, non-compliance with detainers in some jurisdictions at the very least were "inconsistent with ... the intent of Section 1373."
Legal arguments abound. One argument is that the administration is interpreting Section 1373 too broadly in order to include both types of sanctuary cities. Another is that Section 1373 violates the anti-comandeering doctrine of the 10th Amendment.
I guess the real answer is, "stay tuned," but for now, no it does not follow that it is a violation of federal law for a government official to declare a state/city to be a "sanctuary city."