This isn’t a bad idea, but the magnets can only be removed when you take the whole pan off, not just during an oil change. You also have to put one in an area that the oil with literally gravitate to so it’s got a better chance of grabbing the metal particles, while not blocking good flow to the pickup, which usually also located in the best place to grab the most oil.
There’s a product I found for my Harley’s oil filter. The “Motion Pro Filter Magnet” is a magnetic washer (very strong!) that is placed with the hole over the hole on the filter and nabs any metal particles going by. It’s $10, but it’s reusable, and doesn’t block oil flow. Works great on my Harley and my Dodge Ram
They also make external magnets that clamp onto the oil filter, but they tend to be pricier.
There are magnetic bearings that you can drop into the new oil filter at each change, but you have to get one for each oil change, as you don’t go fishing them out unless you enjoy the mess of cracking a dirty oil filter open.