How to fireblock irregular shaped hole in subfloor with pipes and electrical wires?
As you write about in the question, there are expanding foam products designed for this. The most common I see at the home improvement stores is Great Stuff FireBlock. It is less about stopping the actual fire than not giving it a clear path to travel and acting like a chimney.



As far as code, it seems that it could comply with code. There are also a variety of easily purchased fire rated caulks that would work here..