Do I need an enclosed wall box for a cat5e cable?
For mains electrical power, you need fully enclosed boxes, to reduce chance of fires from electrical arcing.  

You don't need that for low voltage wiring.  An open back box or "wish box" is just fine.  Weirdly, I priced the two types of box yesterday, and the "wish box" was 40% more expensive.  

Do not under any circumstances fill any electrical junction box with foam.
You weren't saying you would, but somebody is going to read this and maybe think that.  Anyway, most foams are fire accelerants not retarders, and it is easy for even professionals to make Very Big Mistakes in this area. 

I don't like the starburst shape "gasket" either.  I would install a listed wall plate receptacle so you have a proper Ethernet socket in your wall.  A listed receptacle will be tested for fire safety. Amazon tends to be glutted with Cheese junk and counterfeits, so watch out.