Yes, if an official is granted certain priveleges under the law, removal of those priveleges must be done through law.
There is a blanket law giving pensions to ex-Presidents. Are you saying that law would have to be changed? Or would there have to be a law saying Obama is excluded from that law, or what?