I’ve heard people use Leviticus 18:22 and Leviticus 20:13 to call homosexuality a sin, but don’t these verses only condemn sex among men if done in the worship of idols?

The verses called into question are these: “You shall not lie with a male as with a woman. It is an abomination,” and “If a man lies with a male as he lies with a woman, both of them have committed an abomination. They shall surely be put to death. Their blood shall be upon them.” It is argued that these verses must be taken out of context in order to condemn homosexuality because the context is about shrine prostitution. According to this argument, homosexuality, as a whole, is not mentioned here as sinful, but rather the use of homosexuality in idolatrous harlotry. To test this we must examine the context. First of all, I’ve heard it argued that 17:7 establishes the context that the following chapters are dealing with shrine prostitution. However, 17:7 is not about literal harlotry, for it states: “They shall no more offer their sacrifices to demons, after whom they have played the harlot.” That verse, and every verse around it, is addressing burnt offerings. Verse seven speaks about committing spiritual harlotry against God by giving burnt offerings to demons. Then, in chapter 18, which is almost exclusively given to sins of sexuality, we find a command against sacrificing people to Molech, the sun god (v. 21). Although the verse does not suggest temple prostitution, I understand that such a practice was around at that time. This mention of Molech is what some use as their foundation for verse 22: “You shall not lie with a male as with a woman.” The claim is this: the verse does not refer to all homosexual practices except for prostitution to the sun god. But that cannot be established in the context. There is no connection found between the commandment in verse 21 and the commandment in verse 22. Further, if anyone demands that verse 22 is connected to verse 21 then they must also confess that verse 23 is connected to shrine prostitution, for verse 23 is clearly related to verse 22 as it begins with the word “nor.” “Nor shall you mate with any animal.” To follow this logic, the arguer must confess that bestiality is only wrong as an act of worship to an idol. This is denied by homosexuals who claim to believe the bible, for they believe bestiality is wrong in any way, but I’ve not heard a single answer for verse 23 connected to what they believe is a verse about shrine prostitution (v. 22).
Leviticus 20:13 is even more difficult to prove any connection to idol harlotry. The context (v. 10-21) surrounding the verse does not deal with idolatry, as is evident by the commandments against adultery, uncovering nakedness of family members, sexual relations with in-laws, marrying two women, and bestiality, all of which have no connection to idolatrous practices. Therefore, we must conclude that all acts of homosexuality is an abomination to God, as stated in Leviticus.