Actually the correct fix would be to route the secondary drain line to a visible location. The float switch could stay as an optional back-up in case the secondary drain clogs.
The IRC restrictions make sense to me as the intent is if there’s a problem with the primary drain which starts overflowing the owners should be aware of that (visible condensate flowing or the unit shuts down). Otherwise if there is a primary drain problem, it could be overflowing for quite some time before it’s noticed, which can damage the equipment and/or pans, as well as the building.
I know of at least one case locally where the secondary drain discharge was not visible, and the primary drain clogged (it happens). Over time it damaged the unit and pan, which then started leaking onto a ceiling below. The unit and pan, as well as a section of the ceiling, insulation, and floor below had to be replaced.