It is not illegal for Congress to target specific products. I do not know where you got that impression. Laws can be deemed unconstitutional upon review, but Congress literally defines what is legal or not.
The law must be both specific and punitive to be a bill of attainder. A law can nonpunitively regulate a “class of one” without being a Bill of Attainder. See, Nixon v. Administrator of General Services, 433 U.S. 425 (1977). [0] So, it is not quite accurate that “any law targeting a specific person or company will be struck down”.
OTOH, a “TikTok ban” based on asserted prior misconduct would pretty surely be seen as punitive.